Class FXCanvasEx

  • All Implemented Interfaces:
    Drawable

    public class FXCanvasEx
    extends javafx.embed.swt.FXCanvas
    A replacement of FXCanvas that fixes the following issues:
    • JDK-8088147 - [SWT] FXCanvas: implement custom cursors [workaround for JavaSE-1.8 only, as fixed by SWTCursors in JavaSE-1.9]
    • JDK-8161282 - FXCanvas does not forward horizontal mouse scroll events to the embedded scene. [workaround for JavaSE-1.8 only, as fixed by FXCanvas in JavaSE-1.9]
    • JDK-8143596 - FXCanvas does not forward touch gestures to embedded scene. [workaround for JavaSE-1.8 only, as fixed by FXCanvas in JavaSE-1.9]
    • JDK-8159227 - FXCanvas should properly forward consumption state of key events from SWT to embedded scene.
    • JDK-8161587 - FXCanvas does not consistently render the scene graph when long running event handlers are used.
    • JDK-8088862 - Provide possibility to traverse focus out of FX scene.
    • Constructor Detail

      • FXCanvasEx

        public FXCanvasEx​(Composite parent,
                          int style)
        Creates a new FXCanvasEx for the given parent and with the given style.
        Parameters:
        parent - The Composite to use as parent.
        style - A combination of SWT styles to be applied. Note that the FXCanvas constructor will set the SWT.NO_BACKGROUND style before passing it to the Canvas constructor.
    • Method Detail

      • getFXCanvas

        public static javafx.embed.swt.FXCanvas getFXCanvas​(javafx.scene.Scene scene)
        Returns the FXCanvas which contains the given Scene. Therefore, it is only valid to call this method for a Scene which is embedded into an SWT application via FXCanvas.
        Parameters:
        scene - The Scene for which to determine the surrounding FXCanvas.
        Returns:
        The FXCanvas which contains the given Scene.
      • getStage

        public javafx.stage.Window getStage()
        Returns the stage Window hold by this FXCanvas.
        Returns:
        The stage Window.
      • setScene

        public void setScene​(javafx.scene.Scene newScene)
        Overrides:
        setScene in class javafx.embed.swt.FXCanvas