0
나는이 tutorial을 읽고 성공했습니다.JavaFx embed Swing JDesktopPane에 아무것도 표시되지 않습니다.
스윙 JDesktopPane을 사용하여 내부 프레임을 JavaFX에 포함하고자합니다.
코드 :
public class FxSwingFx extends Application {
private static void createSwing(SwingNode swingNode) {
final JDesktopPane desktopPane = new JDesktopPane();
swingNode.setContent(desktopPane);
final JInternalFrame if1 = new JInternalFrame("Hello, ", true, true, true, true);
final JInternalFrame if2 = new JInternalFrame(" World!", true, true, true, true);
if1 .setVisible(true);
if2 .setVisible(true);
desktopPane.setVisible(true);
desktopPane.add(if1);
desktopPane.add(if2);
}
@Override
public void start(Stage primaryStage) throws Exception {
final SwingNode swingNode = new SwingNode();
final BorderPane root = new BorderPane(swingNode);
root.setBottom(new Button("FX Button"));
SwingUtilities.invokeLater(() -> createSwing(swingNode));
primaryStage.setScene(new Scene(root, 400, 300));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
결과 :
질문 : 왜 내부 프레임이 표시되지 않습니다?