|
Spec-Zone .ru
спецификации, руководства, описания, API
|
public class SwingNode extends Node
setContent(javax.swing.JComponent) method
that accepts an instance of Swing JComponent. The hierarchy of components
contained in the JComponent instance should not contain any heavyweight
components, otherwise SwingNode may fail to paint it. The content gets
repainted automatically. All the input and focus events are forwarded to the
JComponent instance transparently to the developer.
Here is a typical pattern which demonstrates how SwingNode can be used:
public class SwingFx extends Application {
private SwingNode swingNode;
@Override
public void start(Stage stage) {
swingNode = new SwingNode();
createAndSetSwingContent();
StackPane pane = new StackPane();
pane.getChildren().add(swingNode);
stage.setScene(new Scene(pane, 100, 50));
stage.show();
}
private void createAndSetSwingContent() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
swingNode.setContent(new JButton("Click me!"));
}
});
}
}
blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible| Constructor and Description |
|---|
SwingNode()
Constructs a new instance of
SwingNode. |
| Modifier and Type | Method and Description |
|---|---|
javax.swing.JComponent |
getContent()
Returns the
JComponent instance attached to this SwingNode. |
protected boolean |
impl_computeContains(double localX,
double localY) |
com.sun.javafx.geom.BaseBounds |
impl_computeGeomBounds(com.sun.javafx.geom.BaseBounds bounds,
com.sun.javafx.geom.transform.BaseTransform tx)
Computes the geometric bounds for this Node.
|
protected com.sun.javafx.sg.PGNode |
impl_createPGNode() |
java.lang.Object |
impl_processMXNode(com.sun.javafx.jmx.MXNodeAlgorithm alg,
com.sun.javafx.jmx.MXNodeAlgorithmContext ctx)
This method is used by Scene-graph JMX bean to obtain the Scene-graph structure.
|
void |
impl_updatePG()
This function is called during synchronization to update the state of the
PG Node from the FX Node.
|
boolean |
isResizable()
Indicates whether this node is a type which can be resized by its parent.
|
double |
maxHeight(double width)
Returns the node's maximum height for use in layout calculations.
|
double |
maxWidth(double height)
Returns the node's maximum width for use in layout calculations.
|
double |
minHeight(double width)
Returns the node's minimum height for use in layout calculations.
|
double |
minWidth(double height)
Returns the node's minimum width for use in layout calculations.
|
double |
prefHeight(double width)
Returns the node's preferred height for use in layout calculations.
|
double |
prefWidth(double height)
Returns the node's preferred width for use in layout calculations.
|
void |
resize(double width,
double height)
If the node is resizable, will set its layout bounds to the specified
width and height.
|
void |
setContent(javax.swing.JComponent content)
Attaches a
JComponent instance to display in this SwingNode. |
addEventFilter, addEventHandler, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic SwingNode()
SwingNode.public void setContent(javax.swing.JComponent content)
JComponent instance to display in this SwingNode.
The method can be called either on the JavaFX Application thread or the Swing thread. Note however, that access to a Swing component must occur from the Swing thread according to the Swing threading restrictions.
content - a Swing component to display in this SwingNodeEventQueue.isDispatchThread(),
Platform.isFxApplicationThread()public javax.swing.JComponent getContent()
JComponent instance attached to this SwingNode.
The method can be called either on the JavaFX Application thread or the Swing thread. Note however, that access to a Swing component must occur from the Swing thread according to the Swing threading restrictions.
SwingNodeEventQueue.isDispatchThread(),
Platform.isFxApplicationThread()public boolean isResizable()
NodeIf this method returns false, then the parent cannot resize it during layout (resize() is a no-op) and it should return its layoutBounds for minimum, preferred, and maximum sizes. Group, Text, and all Shapes are not resizable and hence depend on the application to establish their sizing by setting appropriate properties (e.g. width/height for Rectangle, text on Text, and so on). Non-resizable nodes may still be relocated during layout.
isResizable in class NodeNode.getContentBias(),
Node.minWidth(double),
Node.minHeight(double),
Node.prefWidth(double),
Node.prefHeight(double),
Node.maxWidth(double),
Node.maxHeight(double),
Node.resize(double, double),
Node.getLayoutBounds()public void resize(double width, double height)
NodeThis method should generally only be called by parent nodes from their layoutChildren() methods. All Parent classes will automatically resize resizable children, so resizing done directly by the application will be overridden by the node's parent, unless the child is unmanaged.
Parents are responsible for ensuring the width and height values fall within the resizable node's preferred range. The autosize() method may be used if the parent just needs to resize the node to its preferred size.
resize in class Nodewidth - the target layout bounds widthheight - the target layout bounds heightNode.isResizable(),
Node.getContentBias(),
Node.autosize(),
Node.minWidth(double),
Node.minHeight(double),
Node.prefWidth(double),
Node.prefHeight(double),
Node.maxWidth(double),
Node.maxHeight(double),
Node.getLayoutBounds()public double maxWidth(double height)
NodeIf the node is not resizable, returns its layoutBounds width.
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the maximum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
If Node's Node.minWidth(double) is greater, it should take precedence
over the maxWidth. This means the Node should never be resized below minWidth.
maxWidth in class Nodeheight - the height that should be used if maximum width depends on itNode.isResizable(),
Node.getContentBias()public double maxHeight(double width)
NodeIf the node is not resizable, returns its layoutBounds height.
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the maximum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
If Node's Node.minHeight(double) is greater, it should take precedence
over the maxHeight. This means the Node should never be resized below minHeight.
maxHeight in class Nodewidth - the width that should be used if maximum height depends on itNode.isResizable(),
Node.getContentBias()public double prefWidth(double height)
NodeLayout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the preferred width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
prefWidth in class Nodeheight - the height that should be used if preferred width depends on itNode.isResizable(),
Node.getContentBias(),
Node.autosize()public double prefHeight(double width)
NodeLayout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the preferred height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
prefHeight in class Nodewidth - the width that should be used if preferred height depends on itNode.getContentBias(),
Node.autosize()public double minWidth(double height)
NodeLayout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the minimum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
If Node's Node.maxWidth(double) is lower than this number,
minWidth takes precedence. This means the Node should never be resized below minWidth.
minWidth in class Nodeheight - the height that should be used if minimum width depends on itNode.isResizable(),
Node.getContentBias()public double minHeight(double width)
NodeLayout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the minimum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
If Node's Node.maxHeight(double) is lower than this number,
minHeight takes precedence. This means the Node should never be resized below minHeight.
minHeight in class Nodewidth - the width that should be used if minimum height depends on itNode.isResizable(),
Node.getContentBias()protected boolean impl_computeContains(double localX, double localY)
impl_computeContains in class Nodeprotected com.sun.javafx.sg.PGNode impl_createPGNode()
impl_createPGNode in class Nodepublic void impl_updatePG()
Nodeimpl_updatePG in class Nodepublic com.sun.javafx.geom.BaseBounds impl_computeGeomBounds(com.sun.javafx.geom.BaseBounds bounds, com.sun.javafx.geom.transform.BaseTransform tx)
Nodeimpl_computeGeomBounds in class Nodepublic java.lang.Object impl_processMXNode(com.sun.javafx.jmx.MXNodeAlgorithm alg, com.sun.javafx.jmx.MXNodeAlgorithmContext ctx)
Nodeimpl_processMXNode in class Nodealg - current algorithm to process this nodectx - current contextCopyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. Use is subject to .