public class SwingNode extends Node
setContent(javax.swing.JComponent)メソッドで指定し、このメソッドはSwing JComponentのインスタンスを受け入れます。 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);
}
}
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, visibleBASELINE_OFFSET_SAME_AS_HEIGHT| コンストラクタと説明 |
|---|
SwingNode()
SwingNodeの新しいインスタンスを構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
JComponent |
getContent()
この
SwingNodeにアタッチされたJComponentインスタンスを返します。 |
boolean |
isResizable()
このノードが、その親によってサイズ変更可能なタイプかどうかを示します。
|
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インスタンスをアタッチします。 |
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, 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, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic void setContent(JComponent content)
SwingNodeに表示するJComponentインスタンスをアタッチします。
このメソッドは、JavaFXアプリケーション・スレッドまたはイベント・ディスパッチ・スレッドで呼び出すことができます。 ただし、スレッドに関するSwingの制限により、Swingコンポーネントに対するそのアクセスは、イベント・ディスパッチ・スレッドから発生する必要があります。
content - このSwingNodeに表示するSwingコンポーネントEventQueue.isDispatchThread(), Platform.isFxApplicationThread()public JComponent getContent()
SwingNodeにアタッチされたJComponentインスタンスを返します。
このメソッドは、JavaFXアプリケーション・スレッドまたはイベント・ディスパッチ・スレッドで呼び出すことができます。 ただし、スレッドに関するSwingの制限により、Swingコンポーネントに対するそのアクセスは、イベント・ディスパッチ・スレッドから発生する必要があります。
SwingNodeにアタッチされたSwingコンポーネントEventQueue.isDispatchThread(), Platform.isFxApplicationThread()public boolean isResizable()
Nodeこのメソッドによってfalseが返されると、親はレイアウト中にそれをサイズ変更できず(resize()の操作なし)、最小、推奨および最大サイズとしてそのlayoutBoundsを返します。 グループ、テキストおよびすべての図形はサイズ変更可能ではないため、そのサイズ設定はアプリケーションで適切なプロパティ(矩形の場合は幅と高さ、テキストの場合はテキストなど)を設定することによって確立する必要があります。 サイズ変更可能でないノードも、レイアウト中に再配置される場合があります。
isResizable、クラス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)
SwingNodeの幅と高さを設定するために、SwingNodeの親によって起動されます。 アプリケーションでこのメソッドを直接呼び出さないようにしてください。 アプリケーションで直接SwingNodeのサイズを設定する必要がある場合は、Swingコンポーネントの最小/推奨/最大サイズ制約を設定する必要があります。この設定は、対応するSwingNodeに伝播され、親によるレイアウト中に考慮されます。 resize、クラスNodewidth - ターゲット・レイアウトのレイアウト境界の幅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()public double prefWidth(double height)
SwingNodeの推奨される幅を返します。 この値はSwingコンポーネントの推奨される幅に対応します。 prefWidth、クラスNodeheight - 推奨される幅がそれに依存する場合に使用する必要がある高さNode.isResizable(), Node.getContentBias(), Node.autosize()public double prefHeight(double width)
SwingNodeの推奨される高さを返します。 この値はSwingコンポーネントの推奨される高さに対応します。 prefHeight、クラスNodewidth - 推奨される高さがそれに依存する場合に使用する必要がある幅Node.getContentBias(), Node.autosize()public double maxWidth(double height)
SwingNodeの最大幅を返します。 この値はSwingコンポーネントの最大幅に対応します。 maxWidth、クラスNodeheight - 最大幅がそれに依存する場合に使用する必要がある高さNode.isResizable(), Node.getContentBias()public double maxHeight(double width)
SwingNodeの最大高さを返します。 この値はSwingコンポーネントの最大高さに対応します。 maxHeight、クラスNodewidth - 最大高さがそれに依存する場合に使用する必要がある幅Node.isResizable(), Node.getContentBias()public double minWidth(double height)
SwingNodeの最小幅を返します。 この値はSwingコンポーネントの最小幅に対応します。 minWidth、クラスNodeheight - 最小幅がそれに依存する場合に使用する必要がある高さNode.isResizable(), Node.getContentBias()public double minHeight(double width)
SwingNodeの最小高さを返します。 この値はSwingコンポーネントの最小高さに対応します。 minHeight、クラスNodewidth - 最小高さがそれに依存する場合に使用する必要がある幅Node.isResizable(), Node.getContentBias()Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.