Spec-Zone .ru
спецификации, руководства, описания, API
|
public class FXCanvas
extends org.eclipse.swt.widgets.Canvas
FXCanvas
is a component to embed JavaFX content into
SWT applications. The content to be displayed is specified
with the setScene(javafx.scene.Scene)
method that accepts an instance of
JavaFX Scene
. After the scene is assigned, it gets
repainted automatically. All the input and focus events are
forwarded to the scene transparently to the developer.
Here is a typical pattern how FXCanvas
can used:
public class Test { private static Scene createScene() { Group group = new Group(); Scene scene = new Scene(group); Button button = new Button("JFX Button"); group.getChildren().add(button); return scene; } public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); FXCanvas canvas = new FXCanvas(shell, SWT.NONE); Scene scene = createScene(); canvas.setScene(scene); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Constructor and Description |
---|
FXCanvas(org.eclipse.swt.widgets.Composite parent,
int style) |
Modifier and Type | Method and Description |
---|---|
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed) |
Scene |
getScene()
Returns the JavaFX scene attached to this
FXCanvas . |
void |
setScene(Scene newScene)
Attaches a
Scene object to display in this FXCanvas . |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, 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, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Composite
public Scene getScene()
FXCanvas
.Scene
attached to this FXCanvas
public void setScene(Scene newScene)
Scene
object to display in this FXCanvas
. This method must called either on the JavaFX
JavaFX application thread (which is the same as the SWT
event dispatch thread).newScene
- a scene to display in this FXCanvas
Platform.isFxApplicationThread()
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to