Package org.eclipse.gef.fx.swt.canvas
Class FXCanvasEx
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Canvas
javafx.embed.swt.FXCanvas
org.eclipse.gef.fx.swt.canvas.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.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFXCanvasEx
(Composite parent, int style) Creates a newFXCanvasEx
for the given parent and with the given style. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyListener
(KeyListener listener) void
addListener
(int eventType, Listener listener) void
addMouseWheelListener
(MouseWheelListener listener) static javafx.embed.swt.FXCanvas
getFXCanvas
(javafx.scene.Scene scene) Returns theFXCanvas
which contains the givenScene
.javafx.stage.Window
getStage()
Returns the stageWindow
hold by thisFXCanvas
.void
removeKeyListener
(KeyListener listener) void
removeListener
(int eventType, Listener listener) void
removeMouseWheelListener
(MouseWheelListener listener) void
setScene
(javafx.scene.Scene newScene) Methods inherited from class javafx.embed.swt.FXCanvas
computeSize, getScene, reskin
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
FXCanvasEx
Creates a newFXCanvasEx
for the given parent and with the given style.- Parameters:
parent
- TheComposite
to use as parent.style
- A combination of SWT styles to be applied. Note that theFXCanvas
constructor will set theSWT.NO_BACKGROUND
style before passing it to theCanvas
constructor.
-
-
Method Details
-
getFXCanvas
public static javafx.embed.swt.FXCanvas getFXCanvas(javafx.scene.Scene scene) Returns theFXCanvas
which contains the givenScene
. Therefore, it is only valid to call this method for aScene
which is embedded into an SWT application viaFXCanvas
.- Parameters:
scene
- TheScene
for which to determine the surroundingFXCanvas
.- Returns:
- The
FXCanvas
which contains the givenScene
.
-
addKeyListener
- Overrides:
addKeyListener
in classControl
-
addListener
- Overrides:
addListener
in classWidget
-
addMouseWheelListener
- Overrides:
addMouseWheelListener
in classControl
-
getStage
public javafx.stage.Window getStage()Returns the stageWindow
hold by thisFXCanvas
.- Returns:
- The stage
Window
.
-
removeKeyListener
- Overrides:
removeKeyListener
in classControl
-
removeListener
- Overrides:
removeListener
in classWidget
-
removeMouseWheelListener
- Overrides:
removeMouseWheelListener
in classControl
-
setScene
public void setScene(javafx.scene.Scene newScene) - Overrides:
setScene
in classjavafx.embed.swt.FXCanvas
-