B4J Tutorial Fix trails when moving Nodes

Discussion in 'B4J Tutorials' started by nobbi59, Apr 27, 2018.

  1. nobbi59

    nobbi59 Active Member Licensed User


    If youre creating apps that work with moving nodes (in my case D'n'D), you may als have seen that moving nodes sometimes results in ugly trails on the Parent Pane.

    Heres how to fix that: We tell JFX to cache the nodes style, that results in a way faster redrawing.

    Dim myView as Node

    'when we move the Node
    Dim jo as JavaObject = myView
    "setCache",Array As Object(True))

    'when moving is done
    jo.RunMethod("setCache",Array As Object(False))
    Why resetting the Cache Value to False again?

    The caching is done by saving the nodes' style as Bitmap. This results in a worse performance when activated for many Nodes.

    Note: You can also use "setCacheHint" to set the Caching Mode. You can find a list of the possible Modes and their description here: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/CacheHint.html
    jmon and stevel05 like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice