- java.lang.Object
-
- javafx.scene.Node
-
- javafx.embed.swing.SwingNode
-
- すべての実装されたインタフェース:
Styleable
,EventTarget
public class SwingNode extends Node
このクラスを使用すると、SwingコンテンツをJavaFXアプリケーションに埋め込むことができます。 表示されるコンテンツはsetContent(javax.swing.JComponent)
メソッドで指定し、このメソッドはSwingJComponent
のインスタンスを受け入れます。JComponent
インスタンスに含まれるコンポーネントの階層には重量コンポーネントが含まれていない必要があり、そうでない場合はSwingNode
によるペイントが失敗します。 コンテンツは自動的に再ペイントされます。 すべての入力イベントとフォーカス・イベントは、開発者に対して透過的にJComponent
インスタンスに転送されます。SwingNode
を使用できる方法を示す標準的なパターンを次に示します。public class SwingFx extends Application { @Override public void start(Stage stage) { final SwingNode swingNode = new SwingNode(); createAndSetSwingContent(swingNode); StackPane pane = new StackPane(); pane.getChildren().add(swingNode); stage.setScene(new Scene(pane, 100, 50)); stage.show(); } private void createAndSetSwingContent(final SwingNode swingNode) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { swingNode.setContent(new JButton("Click me!")); } }); } public static void main(String[] args) { launch(args); } }
- 導入されたバージョン:
- JavaFX 8.0
-
-
プロパティのサマリー
-
クラス javafx.scene.Nodeで宣言されたプロパティ
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, 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, viewOrder, visible
-
-
フィールドのサマリー
-
クラス javafx.scene.Nodeで宣言されたフィールド
BASELINE_OFFSET_SAME_AS_HEIGHT
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 SwingNode()
SwingNode
の新しいインスタンスを構築します。
-
メソッドのサマリー
すべてのメソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 JComponent
getContent()
このSwingNode
にアタッチされたJComponent
インスタンスを返します。double
maxHeight(double width)
レイアウト計算に使用するSwingNode
の最大高さを返します。double
maxWidth(double height)
レイアウト計算に使用するSwingNode
の最大幅を返します。double
minHeight(double width)
レイアウト計算に使用するSwingNode
の最小高さを返します。double
minWidth(double height)
レイアウト計算に使用するSwingNode
の最小幅を返します。double
prefHeight(double width)
レイアウト計算に使用するSwingNode
の推奨される高さを返します。double
prefWidth(double height)
レイアウト計算に使用するSwingNode
の推奨される幅を返します。void
resize(double width, double height)
レイアウト中に、SwingNode
の幅と高さを設定するために、SwingNode
の親によって起動されます。void
setContent(JComponent content)
このSwingNode
に表示するJComponent
インスタンスをアタッチします。-
クラス javafx.scene.Nodeで宣言されたメソッド
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, 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, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, 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, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, 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, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
-
クラス java.lang.Objectで宣言されたメソッド
clone、equals、finalize、getClass、hashCode、notify、notifyAll、wait、wait、wait
-
インタフェース javafx.css.Styleableで宣言されたメソッド
getStyleableNode, getStyleClass
-
-
-
-
メソッドの詳細
-
setContent
public void setContent(JComponent content)
このSwingNode
に表示するJComponent
インスタンスをアタッチします。このメソッドは、JavaFXアプリケーション・スレッドまたはイベント・ディスパッチ・スレッドで呼び出すことができます。 ただし、スレッドに関するSwingの制限により、Swingコンポーネントに対するそのアクセスは、イベント・ディスパッチ・スレッドから発生する必要があります。
- パラメータ:
content
- このSwingNode
に表示するSwingコンポーネント- 関連項目:
EventQueue.isDispatchThread()
,Platform.isFxApplicationThread()
-
getContent
public JComponent getContent()
このSwingNode
にアタッチされたJComponent
インスタンスを返します。このメソッドは、JavaFXアプリケーション・スレッドまたはイベント・ディスパッチ・スレッドで呼び出すことができます。 ただし、スレッドに関するSwingの制限により、Swingコンポーネントに対するそのアクセスは、イベント・ディスパッチ・スレッドから発生する必要があります。
- 戻り値:
- この
SwingNode
にアタッチされたSwingコンポーネント - 関連項目:
EventQueue.isDispatchThread()
,Platform.isFxApplicationThread()
-
resize
public void resize(double width, double height)
レイアウト中に、SwingNode
の幅と高さを設定するために、SwingNode
の親によって起動されます。 アプリケーションでこのメソッドを直接呼び出さないようにしてください。 アプリケーションで直接SwingNode
のサイズを設定する必要がある場合は、Swingコンポーネントの最小/推奨/最大サイズ制約を設定する必要があります。この設定は、対応するSwingNode
に伝播され、親によるレイアウト中に考慮されます。- オーバーライド:
resize
、クラス:Node
- パラメータ:
width
- ターゲット・レイアウトのレイアウト境界の幅height
- ターゲット・レイアウトのレイアウト境界の高さ- 関連項目:
Node.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()
-
prefWidth
public double prefWidth(double height)
レイアウト計算に使用するSwingNode
の推奨される幅を返します。 この値はSwingコンポーネントの推奨される幅に対応します。- オーバーライド:
prefWidth
、クラス:Node
- パラメータ:
height
- 推奨される幅がそれに依存する場合に使用する必要がある高さ- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる推奨される幅
- 関連項目:
Node.isResizable()
、Node.getContentBias()
、Node.autosize()
-
prefHeight
public double prefHeight(double width)
レイアウト計算に使用するSwingNode
の推奨される高さを返します。 この値はSwingコンポーネントの推奨される高さに対応します。- オーバーライド:
prefHeight
、クラス:Node
- パラメータ:
width
- 推奨される高さがそれに依存する場合に使用する必要がある幅- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる推奨される高さ
- 関連項目:
Node.getContentBias()
、Node.autosize()
-
maxWidth
public double maxWidth(double height)
レイアウト計算に使用するSwingNode
の最大幅を返します。 この値はSwingコンポーネントの最大幅に対応します。- オーバーライド:
maxWidth
、クラス:Node
- パラメータ:
height
- 最大幅がそれに依存する場合に使用する必要がある高さ- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる最大幅
- 関連項目:
Node.isResizable()
、Node.getContentBias()
-
maxHeight
public double maxHeight(double width)
レイアウト計算に使用するSwingNode
の最大高さを返します。 この値はSwingコンポーネントの最大高さに対応します。- オーバーライド:
maxHeight
、クラス:Node
- パラメータ:
width
- 最大高さがそれに依存する場合に使用する必要がある幅- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる最大高さ
- 関連項目:
Node.isResizable()
、Node.getContentBias()
-
minWidth
public double minWidth(double height)
レイアウト計算に使用するSwingNode
の最小幅を返します。 この値はSwingコンポーネントの最小幅に対応します。- オーバーライド:
minWidth
、クラス:Node
- パラメータ:
height
- 最小幅がそれに依存する場合に使用する必要がある高さ- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる最小幅
- 関連項目:
Node.isResizable()
、Node.getContentBias()
-
minHeight
public double minHeight(double width)
レイアウト計算に使用するSwingNode
の最小高さを返します。 この値はSwingコンポーネントの最小高さに対応します。- オーバーライド:
minHeight
、クラス:Node
- パラメータ:
width
- 最小高さがそれに依存する場合に使用する必要がある幅- 戻り値:
- レイアウト中にノードのサイズ変更の基準となる最小高さ
- 関連項目:
Node.isResizable()
、Node.getContentBias()
-
-