Top Description Inners Fields Constructors Methods
javafx.embed.swing

public Class JFXPanel

extends JComponent
Class Inheritance
Imports
java.awt.AlphaComposite, .Component, .ComponentOrientation, .Cursor, .Dimension, .Graphics, .GraphicsConfiguration, .Graphics2D, .KeyboardFocusManager, .Point, .Window, .Insets, .EventQueue, .SecondaryLoop, .GraphicsEnvironment, .Rectangle, java.awt.event.AWTEventListener, .ComponentEvent, .FocusEvent, .HierarchyEvent, .InputEvent, .InputMethodEvent, .KeyEvent, .MouseEvent, .MouseWheelEvent, .InvocationEvent, java.awt.geom.AffineTransform, java.awt.im.InputMethodRequests, java.awt.image.BufferedImage, .DataBufferInt, java.nio.IntBuffer, java.util.concurrent.atomic.AtomicInteger, javax.swing.JComponent, .SwingUtilities, javafx.application.Platform, javafx.geometry.Point2D, .NodeOrientation, javafx.scene.Scene, com.sun.glass.ui.Screen, com.sun.javafx.application.PlatformImpl, com.sun.javafx.cursor.CursorFrame, com.sun.javafx.stage.EmbeddedWindow, com.sun.javafx.tk.Toolkit, com.sun.javafx.PlatformUtil, com.sun.javafx.logging.PlatformLogger, com.sun.javafx.embed.AbstractEvents, .EmbeddedSceneInterface, .EmbeddedStageInterface, .HostInterface, com.sun.javafx.embed.swing.SwingDnD, .SwingEvents, .SwingCursors, .SwingNodeHelper, com.sun.javafx.embed.swing.newimpl.JFXPanelInteropN

JFXPanel is a component to embed JavaFX content into Swing applications. The content to be displayed is specified with the setScene 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.

There are some restrictions related to JFXPanel. As a Swing component, it should only be accessed from the event dispatch thread, except the setScene method, which can be called either on the event dispatch thread or on the JavaFX application thread.

Here is a typical pattern how JFXPanel can used:

    public class Test {

        private static void initAndShowGUI() {
            // This method is invoked on Swing thread
            JFrame frame = new JFrame("FX");
            final JFXPanel fxPanel = new JFXPanel();
            frame.add(fxPanel);
            frame.setVisible(true);

            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    initFX(fxPanel);
                }
            });
        }

        private static void initFX(JFXPanel fxPanel) {
            // This method is invoked on JavaFX thread
            Scene scene = createScene();
            fxPanel.setScene(scene);
        }

        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    initAndShowGUI();
                }
            });
        }
    }

Warning

Serialized objects of this class will not be compatible with future Swing or JavaFX releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing and the same version of JavaFX.

Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private AtomicInteger
private transient SwingDnD
private static PlatformImpl.FinishListener
private static boolean
private transient JFXPanel.HostContainer
private static AtomicInteger
private boolean
private JFXPanelInteropN
private static final PlatformLogger
private volatile float
private int
private BufferedImage
private volatile int
private volatile int
private int
private double
private double
private transient volatile Scene
private transient EmbeddedSceneInterface
private volatile int
private volatile int
private transient volatile EmbeddedWindow
private transient EmbeddedStageInterface
private transient AWTEventListener
Inherited from javax.swing.JComponent:
listenerListTOOL_TIP_TEXT_KEYuiUNDEFINED_CONDITIONWHEN_ANCESTOR_OF_FOCUSED_COMPONENTWHEN_FOCUSEDWHEN_IN_FOCUSED_WINDOW

Constructor Summary

AccessConstructor and Description
public
JFXPanel()

Creates a new JFXPanel object.

Method Summary

Modifier and TypeMethod and Description
public void
addNotify()

Overrides javax.swing.JComponent.addNotify.

Notifies this component that it now has a parent component.

private Point2D
private void
createResizePixelBuffer(double newScaleFactorX, double newScaleFactorY)

private synchronized void
private Screen
findScreen(GraphicsConfiguration graphicsConfiguration)

private AffineTransform
public InputMethodRequests
getInputMethodRequests()

Overrides java.awt.Component.getInputMethodRequests.

Gets the input method request handler which supports requests from input methods for this component.

public Dimension

Returns:

prefSize this JFXPanel preferred size
getPreferredSize
()

Overrides javax.swing.JComponent.getPreferredSize.

Returns the preferred size of this JFXPanel, either previously set with setPreferredSize(Dimension) or based on the content of the JavaFX scene attached to this JFXPanel.

public Scene

Returns:

the Scene attached to this JFXPanel
getScene
()

Returns the JavaFX scene attached to this JFXPanel.

private static synchronized void
private void
private boolean
public final boolean

Returns:

a false value
isOpaque
()

Overrides javax.swing.JComponent.isOpaque.

JFXPanel's opacity is controlled by the JavaFX content which is displayed in this component, so this method overrides javax.swing.JComponent#isOpaque() to always return a false value.

protected void
paintComponent(Graphics
the Graphics context in which to paint
g
)

Overrides javax.swing.JComponent.paintComponent.

Overrides the javax.swing.JComponent#paintComponent(Graphics) method to paint the content of the JavaFX scene attached to this JFXpanel.

protected void
processComponentEvent(ComponentEvent
the component event to dispatch to the JavaFX scene
e
)

Overrides java.awt.Component.processComponentEvent.

Overrides the java.awt.Component#processComponentEvent(ComponentEvent) method to dispatch java.awt.event.ComponentEvent#COMPONENT_RESIZED events to the JavaFX scene attached to this JFXPanel.

protected void
processFocusEvent(FocusEvent
the focus event to dispatch to the JavaFX scene
e
)

Overrides java.awt.Component.processFocusEvent.

Overrides the java.awt.Component#processFocusEvent(FocusEvent) method to dispatch focus events to the JavaFX scene attached to this JFXPanel.

protected void
processHierarchyBoundsEvent(HierarchyEvent
the hierarchy bounds event to process
e
)

Overrides java.awt.Component.processHierarchyBoundsEvent.

Overrides the java.awt.Component#processHierarchyBoundsEvent(HierarchyEvent) method to process java.awt.event.HierarchyEvent#ANCESTOR_MOVED events and update the JavaFX scene location to match the JFXPanel location on the screen.

protected void
processHierarchyEvent(HierarchyEvent
the hierarchy event
e
)

Overrides java.awt.Component.processHierarchyEvent.

Processes hierarchy events occurring on this component by dispatching them to any registered HierarchyListener objects.

protected void
processInputMethodEvent(InputMethodEvent
the input method event
e
)

Overrides java.awt.Component.processInputMethodEvent.

Processes input method events occurring on this component by dispatching them to any registered InputMethodListener objects.

protected void
processKeyEvent(KeyEvent
the key event to dispatch to the JavaFX scene
e
)

Overrides javax.swing.JComponent.processKeyEvent.

Overrides the java.awt.Component#processKeyEvent(KeyEvent) method to dispatch the key event to the JavaFX scene attached to this JFXPanel.

protected void
processMouseEvent(MouseEvent
the mouse event to dispatch to the JavaFX scene
e
)

Overrides javax.swing.JComponent.processMouseEvent.

Overrides the java.awt.Component#processMouseEvent(MouseEvent) method to dispatch the mouse event to the JavaFX scene attached to this JFXPanel.

protected void
processMouseMotionEvent(MouseEvent
the mouse motion event to dispatch to the JavaFX scene
e
)

Overrides javax.swing.JComponent.processMouseMotionEvent.

Overrides the java.awt.Component#processMouseMotionEvent(MouseEvent) method to dispatch the mouse motion event to the JavaFX scene attached to this JFXPanel.

protected void
processMouseWheelEvent(MouseWheelEvent
the mouse wheel event to dispatch to the JavaFX scene
e
)

Overrides java.awt.Component.processMouseWheelEvent.

Overrides the java.awt.Component#processMouseWheelEvent(MouseWheelEvent) method to dispatch the mouse wheel event to the JavaFX scene attached to this JFXPanel.

private synchronized void
public void
removeNotify()

Overrides javax.swing.JComponent.removeNotify.

Notifies this component that it no longer has a parent component.

private void
private void
private void
private void
private void
private void
private void
setFxEnabled(boolean enabled)

public final void
setOpaque(boolean
must be false
opaque
)

Overrides javax.swing.JComponent.setOpaque.

JFXPanel's opacity is controlled by the JavaFX content which is displayed in this component, so this method overrides javax.swing.JComponent#setOpaque(boolean) to only accept a false value.

public void
setScene(final Scene
a scene to display in this JFXpanel
newScene
)

Attaches a Scene object to display in this JFXPanel.

private void
setSceneImpl(Scene newScene)

pack-priv final BufferedImage
private void
private boolean
Inherited from javax.swing.JComponent:
addAncestorListeneraddVetoableChangeListenercomputeVisibleRectcontainscreateToolTipdisableenablefirePropertyChangefirePropertyChangefirePropertyChangefireVetoableChangegetActionForKeyStrokegetActionMapgetAlignmentXgetAlignmentYgetAncestorListenersgetAutoscrollsgetBaselinegetBaselineResizeBehaviorgetBordergetBoundsgetClientPropertygetComponentGraphicsgetComponentPopupMenugetConditionForKeyStrokegetDebugGraphicsOptionsgetDefaultLocalegetFontMetricsgetGraphicsgetHeightgetInheritsPopupMenugetInputMapgetInputMapgetInputVerifiergetInsetsgetInsetsgetListenersgetLocationgetMaximumSizegetMinimumSizegetNextFocusableComponentgetPopupLocationgetRegisteredKeyStrokesgetRootPanegetSizegetToolTipLocationgetToolTipTextgetToolTipTextgetTopLevelAncestorgetTransferHandlergetUIgetUIClassIDgetVerifyInputWhenFocusTargetgetVetoableChangeListenersgetVisibleRectgetWidthgetXgetYgrabFocushideisDoubleBufferedisLightweightComponentisManagingFocusisOptimizedDrawingEnabledisPaintingForPrintisPaintingOriginisPaintingTileisRequestFocusEnabledisValidateRootpaintpaintBorderpaintChildrenpaintImmediatelypaintImmediatelyparamStringprintprintAllprintBorderprintChildrenprintComponentprocessComponentKeyEventprocessKeyBindingputClientPropertyregisterKeyboardActionregisterKeyboardActionremoveAncestorListenerremoveVetoableChangeListenerrepaintrepaintrequestDefaultFocusrequestFocusrequestFocusrequestFocusInWindowrequestFocusInWindowresetKeyboardActionsreshaperevalidatescrollRectToVisiblesetActionMapsetAlignmentXsetAlignmentYsetAutoscrollssetBackgroundsetBordersetComponentPopupMenusetDebugGraphicsOptionssetDefaultLocalesetDoubleBufferedsetEnabledsetFocusTraversalKeyssetFontsetForegroundsetInheritsPopupMenusetInputMapsetInputVerifiersetMaximumSizesetMinimumSizesetNextFocusableComponentsetPreferredSizesetRequestFocusEnabledsetToolTipTextsetTransferHandlersetUIsetVerifyInputWhenFocusTargetsetVisibleunregisterKeyboardActionupdateupdateUI

Field Detail

disableCountback to summary
private AtomicInteger disableCount
Annotations
@SuppressWarnings:doclint:missing
dndback to summary
private transient SwingDnD dnd
finishListenerback to summary
private static PlatformImpl.FinishListener finishListener
fxInitializedback to summary
private static boolean fxInitialized
hostContainerback to summary
private transient JFXPanel.HostContainer hostContainer
instanceCountback to summary
private static AtomicInteger instanceCount
isCapturingMouseback to summary
private boolean isCapturingMouse
Annotations
@SuppressWarnings:doclint:missing
jfxPanelIOPback to summary
private JFXPanelInteropN jfxPanelIOP
Annotations
@SuppressWarnings:doclint:missing
logback to summary
private static final PlatformLogger log

Hides java.awt.Container.log.

opacityback to summary
private volatile float opacity
Annotations
@SuppressWarnings:doclint:missing
pHeightback to summary
private int pHeight
Annotations
@SuppressWarnings:doclint:missing
pixelsImback to summary
private BufferedImage pixelsIm
Annotations
@SuppressWarnings:doclint:missing
pPreferredHeightback to summary
private volatile int pPreferredHeight
Annotations
@SuppressWarnings:doclint:missing
pPreferredWidthback to summary
private volatile int pPreferredWidth
Annotations
@SuppressWarnings:doclint:missing
pWidthback to summary
private int pWidth
Annotations
@SuppressWarnings:doclint:missing
scaleFactorXback to summary
private double scaleFactorX
Annotations
@SuppressWarnings:doclint:missing
scaleFactorYback to summary
private double scaleFactorY
Annotations
@SuppressWarnings:doclint:missing
sceneback to summary
private transient volatile Scene scene
scenePeerback to summary
private transient EmbeddedSceneInterface scenePeer
screenXback to summary
private volatile int screenX
Annotations
@SuppressWarnings:doclint:missing
screenYback to summary
private volatile int screenY
Annotations
@SuppressWarnings:doclint:missing
stageback to summary
private transient volatile EmbeddedWindow stage
stagePeerback to summary
private transient EmbeddedStageInterface stagePeer
ungrabListenerback to summary
private transient AWTEventListener ungrabListener

Constructor Detail

JFXPanelback to summary
public JFXPanel()

Creates a new JFXPanel object.

Implementation Note

when the first JFXPanel object is created, it implicitly initializes the JavaFX runtime. This is the preferred way to initialize JavaFX in Swing.

Method Detail

addNotifyback to summary
public void addNotify()

Overrides javax.swing.JComponent.addNotify.

Notifies this component that it now has a parent component. When this method is invoked, the chain of parent components is set up with KeyboardAction event listeners.

Annotations
@Override
convertSwingToFxPixelback to summary
private Point2D convertSwingToFxPixel(GraphicsConfiguration g, double wx, double wy)
createResizePixelBufferback to summary
private void createResizePixelBuffer(double newScaleFactorX, double newScaleFactorY)
deregisterFinishListenerback to summary
private synchronized void deregisterFinishListener()
findScreenback to summary
private Screen findScreen(GraphicsConfiguration graphicsConfiguration)
getCurrentTransformback to summary
private AffineTransform getCurrentTransform()
getInputMethodRequestsback to summary
public InputMethodRequests getInputMethodRequests()

Overrides java.awt.Component.getInputMethodRequests.

Doc from java.awt.Component.getInputMethodRequests.

Gets the input method request handler which supports requests from input methods for this component. A component that supports on-the-spot text input must override this method to return an InputMethodRequests instance. At the same time, it also has to handle input method events.

Returns:InputMethodRequests

the input method request handler for this component, null by default

Annotations
@Override
getPreferredSizeback to summary
public Dimension getPreferredSize()

Overrides javax.swing.JComponent.getPreferredSize.

Returns the preferred size of this JFXPanel, either previously set with setPreferredSize(Dimension) or based on the content of the JavaFX scene attached to this JFXPanel.

Returns:Dimension

prefSize this JFXPanel preferred size

Annotations
@Override
getSceneback to summary
public Scene getScene()

Returns the JavaFX scene attached to this JFXPanel.

Returns:Scene

the Scene attached to this JFXPanel

initFxback to summary
private static synchronized void initFx()
invokeOnClientEDTback to summary
private void invokeOnClientEDT(Runnable r)
isFxEnabledback to summary
private boolean isFxEnabled()
isOpaqueback to summary
public final boolean isOpaque()

Overrides javax.swing.JComponent.isOpaque.

JFXPanel's opacity is controlled by the JavaFX content which is displayed in this component, so this method overrides javax.swing.JComponent#isOpaque() to always return a false value.

Returns:boolean

a false value

Annotations
@Override
paintComponentback to summary
protected void paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

Overrides the javax.swing.JComponent#paintComponent(Graphics) method to paint the content of the JavaFX scene attached to this JFXpanel.

Parameters
g:Graphics

the Graphics context in which to paint

Annotations
@Override
See Also
isOpaque()
processComponentEventback to summary
protected void processComponentEvent(ComponentEvent e)

Overrides java.awt.Component.processComponentEvent.

Overrides the java.awt.Component#processComponentEvent(ComponentEvent) method to dispatch java.awt.event.ComponentEvent#COMPONENT_RESIZED events to the JavaFX scene attached to this JFXPanel. The JavaFX scene object is then resized to match the JFXPanel size.

Parameters
e:ComponentEvent

the component event to dispatch to the JavaFX scene

Annotations
@Override
processFocusEventback to summary
protected void processFocusEvent(FocusEvent e)

Overrides java.awt.Component.processFocusEvent.

Overrides the java.awt.Component#processFocusEvent(FocusEvent) method to dispatch focus events to the JavaFX scene attached to this JFXPanel.

Parameters
e:FocusEvent

the focus event to dispatch to the JavaFX scene

Annotations
@Override
processHierarchyBoundsEventback to summary
protected void processHierarchyBoundsEvent(HierarchyEvent e)

Overrides java.awt.Component.processHierarchyBoundsEvent.

Overrides the java.awt.Component#processHierarchyBoundsEvent(HierarchyEvent) method to process java.awt.event.HierarchyEvent#ANCESTOR_MOVED events and update the JavaFX scene location to match the JFXPanel location on the screen.

Parameters
e:HierarchyEvent

the hierarchy bounds event to process

Annotations
@Override
processHierarchyEventback to summary
protected void processHierarchyEvent(HierarchyEvent e)

Overrides java.awt.Component.processHierarchyEvent.

Doc from java.awt.Component.processHierarchyEvent.

Processes hierarchy events occurring on this component by dispatching them to any registered HierarchyListener objects.

This method is not called unless hierarchy events are enabled for this component. Hierarchy events are enabled when one of the following occurs:

  • An HierarchyListener object is registered via addHierarchyListener.
  • Hierarchy events are enabled via enableEvents.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters
e:HierarchyEvent

the hierarchy event

Annotations
@Override
processInputMethodEventback to summary
protected void processInputMethodEvent(InputMethodEvent e)

Overrides java.awt.Component.processInputMethodEvent.

Doc from java.awt.Component.processInputMethodEvent.

Processes input method events occurring on this component by dispatching them to any registered InputMethodListener objects.

This method is not called unless input method events are enabled for this component. Input method events are enabled when one of the following occurs:

  • An InputMethodListener object is registered via addInputMethodListener.
  • Input method events are enabled via enableEvents.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters
e:InputMethodEvent

the input method event

Annotations
@Override
processKeyEventback to summary
protected void processKeyEvent(KeyEvent e)

Overrides javax.swing.JComponent.processKeyEvent.

Overrides the java.awt.Component#processKeyEvent(KeyEvent) method to dispatch the key event to the JavaFX scene attached to this JFXPanel.

Parameters
e:KeyEvent

the key event to dispatch to the JavaFX scene

Annotations
@Override
processMouseEventback to summary
protected void processMouseEvent(MouseEvent e)

Overrides javax.swing.JComponent.processMouseEvent.

Overrides the java.awt.Component#processMouseEvent(MouseEvent) method to dispatch the mouse event to the JavaFX scene attached to this JFXPanel.

Parameters
e:MouseEvent

the mouse event to dispatch to the JavaFX scene

Annotations
@Override
processMouseMotionEventback to summary
protected void processMouseMotionEvent(MouseEvent e)

Overrides javax.swing.JComponent.processMouseMotionEvent.

Overrides the java.awt.Component#processMouseMotionEvent(MouseEvent) method to dispatch the mouse motion event to the JavaFX scene attached to this JFXPanel.

Parameters
e:MouseEvent

the mouse motion event to dispatch to the JavaFX scene

Annotations
@Override
processMouseWheelEventback to summary
protected void processMouseWheelEvent(MouseWheelEvent e)

Overrides java.awt.Component.processMouseWheelEvent.

Overrides the java.awt.Component#processMouseWheelEvent(MouseWheelEvent) method to dispatch the mouse wheel event to the JavaFX scene attached to this JFXPanel.

Parameters
e:MouseWheelEvent

the mouse wheel event to dispatch to the JavaFX scene

Annotations
@Override
registerFinishListenerback to summary
private synchronized void registerFinishListener()
removeNotifyback to summary
public void removeNotify()

Overrides javax.swing.JComponent.removeNotify.

Notifies this component that it no longer has a parent component. When this method is invoked, any KeyboardActions set up in the the chain of parent components are removed.

Annotations
@Override
sendFocusEventToFXback to summary
private void sendFocusEventToFX(final FocusEvent e)
sendInputMethodEventToFXback to summary
private void sendInputMethodEventToFX(InputMethodEvent e)
sendKeyEventToFXback to summary
private void sendKeyEventToFX(final KeyEvent e)
sendMouseEventToFXback to summary
private void sendMouseEventToFX(MouseEvent e)
sendMoveEventToFXback to summary
private void sendMoveEventToFX()
sendResizeEventToFXback to summary
private void sendResizeEventToFX()
setFxEnabledback to summary
private void setFxEnabled(boolean enabled)
setOpaqueback to summary
public final void setOpaque(boolean opaque)

Overrides javax.swing.JComponent.setOpaque.

JFXPanel's opacity is controlled by the JavaFX content which is displayed in this component, so this method overrides javax.swing.JComponent#setOpaque(boolean) to only accept a false value. If this method is called with a true value, no action is performed.

Parameters
opaque:boolean

must be false

Annotations
@Override
setSceneback to summary
public void setScene(final Scene newScene)

Attaches a Scene object to display in this JFXPanel. This method can be called either on the event dispatch thread or the JavaFX application thread.

Parameters
newScene:Scene

a scene to display in this JFXpanel

See Also
java.awt.EventQueue#isDispatchThread(), javafx.application.Platform#isFxApplicationThread()
setSceneImplback to summary
private void setSceneImpl(Scene newScene)
test_getPixelsImback to summary
pack-priv final BufferedImage test_getPixelsIm()
updateComponentSizeback to summary
private void updateComponentSize()
updateScreenLocationback to summary
private boolean updateScreenLocation()
javafx.embed.swing back to summary

private Class JFXPanel.HostContainer

extends Object
implements HostInterface
Class Inheritance
All Implemented Interfaces
com.sun.javafx.embed.HostInterface

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private Cursor
getPlatformCursor(final CursorFrame cursorFrame)

public boolean
grabFocus()

Implements com.sun.javafx.embed.HostInterface.grabFocus.

Grabs focus on this window.

public void
public boolean
public void
public void
public void
public void
public void
setPreferredSize(final int width, final int height)

Implements com.sun.javafx.embed.HostInterface.setPreferredSize.

public boolean
public void
ungrabFocus()

Implements com.sun.javafx.embed.HostInterface.ungrabFocus.

Manually ungrabs focus grabbed on this window previously.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HostContainerback to summary
private HostContainer()

Method Detail

getPlatformCursorback to summary
private Cursor getPlatformCursor(final CursorFrame cursorFrame)
grabFocusback to summary
public boolean grabFocus()

Implements com.sun.javafx.embed.HostInterface.grabFocus.

Doc from com.sun.javafx.embed.HostInterface.grabFocus.

Grabs focus on this window. All mouse clicks that occur in this window's client area or client-areas of any of its unfocusable owned windows are delivered as usual. Whenever a click occurs on another app's window (not related via the ownership relation with this one, or a focusable owned window), or on non-client area of any window (titlebar, etc.), or any third-party app's window, or native OS GUI (e.g. a taskbar), the grab is automatically reset, and the window that held the grab receives the FOCUS_UNGRAB event. Note that for this functionality to work correctly, the window must have a focus upon calling this method. All owned popup windows that should be operable during the grabbed focus state (e.g. nested popup menus) must be unfocusable (see setFocusable). Clicking a focusable owned window will reset the grab due to a focus transfer. The click that occurs in another window and causes resetting of the grab may or may not be delivered to that other window depending on the native OS behavior. If any of the application's windows already holds the grab, it is reset prior to grabbing the focus for this window. The method may be called multiple times for one window. Subsequent calls do not affect the grab status unless it is reset between the calls, in which case the focus is grabbed again. Note that grabbing the focus on an application window may prevent delivering certain events to other applications until the grab is reset. Therefore, if the application has finished showing popup windows based on a user action (e.g. clicking a menu item), and doesn't require the grab any more, it should call the ungrabFocus method. The FOCUS_UNGRAB event signals that the grab has been reset. A user event handler associated with a menu item must be invoked after resetting the grab. Otherwise, if a developer debugs the application and has installed a breakpoint in the event handler, the debugger may become unoperable due to events blocking for other applications on some platforms.

Returns:boolean

true if the operation is successful

Annotations
@Override
repaintback to summary
public void repaint()

Implements com.sun.javafx.embed.HostInterface.repaint.

Annotations
@Override
requestFocusback to summary
public boolean requestFocus()

Implements com.sun.javafx.embed.HostInterface.requestFocus.

Annotations
@Override
setCursorback to summary
public void setCursor(CursorFrame cursorFrame)

Implements com.sun.javafx.embed.HostInterface.setCursor.

Annotations
@Override
setEmbeddedSceneback to summary
public void setEmbeddedScene(EmbeddedSceneInterface embeddedScene)

Implements com.sun.javafx.embed.HostInterface.setEmbeddedScene.

Annotations
@Override
setEmbeddedStageback to summary
public void setEmbeddedStage(EmbeddedStageInterface embeddedStage)

Implements com.sun.javafx.embed.HostInterface.setEmbeddedStage.

Annotations
@Override
setEnabledback to summary
public void setEnabled(final boolean enabled)

Implements com.sun.javafx.embed.HostInterface.setEnabled.

Annotations
@Override
setPreferredSizeback to summary
public void setPreferredSize(final int width, final int height)

Implements com.sun.javafx.embed.HostInterface.setPreferredSize.

Annotations
@Override
traverseFocusOutback to summary
public boolean traverseFocusOut(boolean forward)

Implements com.sun.javafx.embed.HostInterface.traverseFocusOut.

Annotations
@Override
ungrabFocusback to summary
public void ungrabFocus()

Implements com.sun.javafx.embed.HostInterface.ungrabFocus.

Doc from com.sun.javafx.embed.HostInterface.ungrabFocus.

Manually ungrabs focus grabbed on this window previously. This method resets the grab, and forces sending of the FOCUS_UNGRAB event. It should be used when popup windows (such as menus) should be dismissed manually, e.g. when a user clicks a menu item which usually causes the menus to hide.

Annotations
@Override