當前位置: 首頁>>代碼示例>>Java>>正文


Java JFXPanel.setScene方法代碼示例

本文整理匯總了Java中javafx.embed.swing.JFXPanel.setScene方法的典型用法代碼示例。如果您正苦於以下問題:Java JFXPanel.setScene方法的具體用法?Java JFXPanel.setScene怎麽用?Java JFXPanel.setScene使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.embed.swing.JFXPanel的用法示例。


在下文中一共展示了JFXPanel.setScene方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createScene

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private void createScene(JFXPanel fxMainPanel) {
    redPane = new StackPane();
    redPane.setPrefSize(100.0, 100.0);
    redPane.setStyle("-fx-background-color: red");
    ContextMenu contextMenu = new ContextMenu();
    MenuItem menuItem = new MenuItem("Test Menu Item");
    contextMenu.getItems().add(menuItem);

    redPane.setOnContextMenuRequested(event -> {
        contextMenu.show(redPane, event.getScreenX(), event.getScreenY());
        event.consume();
    });
    contextMenu.showingProperty().addListener(this::onchange);
    scene = new Scene(redPane);
    fxMainPanel.setScene(scene);
    robot.setAutoWaitForIdle(true);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:18,代碼來源:SwingContextMenuApp.java

示例2: showMessageDialog

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
public static boolean showMessageDialog(final String title, final Node node) {
		if (Platform.isFxApplicationThread()) {
			Alert alert = new Alert(AlertType.NONE, null, ButtonType.OK);
			alert.setTitle(title);
			alert.getDialogPane().setContent(node);
//			if (resizable) {
//				// Note: there is nothing to stop the dialog being shrunk to a ridiculously small size!
//				alert.setResizable(resizable);
//			}
			Optional<ButtonType> result = alert.showAndWait();
			return result.isPresent() && result.get() == ButtonType.OK;
		} else {
			JFXPanel panel = new JFXPanel();
			panel.setScene(new Scene(new StackPane(node)));
			return JOptionPane.showConfirmDialog(null, panel, title, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION;
		}
	}
 
開發者ID:qupath,項目名稱:qupath,代碼行數:18,代碼來源:DisplayHelpers.java

示例3: createScene

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private void createScene(JFXPanel panel) {
    root = new StackPane();
    scene = new Scene(root, backgroundColor);
    panel.setScene(scene);

    background = new Group();
    root.getChildren().addAll(new Pane(background));

    addEventHooks(panel);

    long sleepTimeMillis = 5;
    timeline = new Timeline(new KeyFrame(Duration.ZERO, new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            if (updateAction == null)
                return;
            updateAction.run();
        }
    }), new KeyFrame(Duration.millis(sleepTimeMillis)));
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.play();

    starting = false;
}
 
開發者ID:AaronFriesen,項目名稱:Trydent,代碼行數:25,代碼來源:SwingManager.java

示例4: configureCircos

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
@Override
void configureCircos(JFXPanel p) {
    Circos[] widgets = new Circos[] {
        new Circos(new long[]{34,56,90, 65, 10},null,null),
        new Circos(new long[]{34,56,90, 200, 10},null,null),
        new Circos(new long[]{34,56,90, 32, 10},null,null)
    };
    widgets[0].setTitle("Plot 1");
    widgets[1].setTitle("Plot 2");
    widgets[2].setTitle("Plot 3");
    
    for (Circos widget: widgets){
        widget.setStrokeWidth(1);
        widget.initialize();
        loadLinks(widget);
    }
    circos.gui.MultiChart gui = new circos.gui.MultiChart(widgets);
    p.setScene(new Scene(gui));
    
    // only one is moving... ;-)
    widgets[1].doFancyStuffs();
}
 
開發者ID:paolopavan,項目名稱:circosFX,代碼行數:23,代碼來源:MultiChartTest.java

示例5: initBrowser

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
@SuppressWarnings("restriction")
void initBrowser()
{
	Stage stage = new Stage();

	stage.setTitle("Hello Java FX");
	stage.setResizable(true);

	Group root = new Group();
	Scene scene = new Scene(root, 1, 1);
	stage.setScene(scene);

	// Set up the embedded browser:
	browser = new WebView();
	browser.setPrefSize(630, 435);
	ObservableList<Node> children = root.getChildren();
	children.add(browser);

	JFXPanel jfxPanel = new JFXPanel();
	jfxPanel.setScene(scene);

	activitySummary.add(jfxPanel, BorderLayout.CENTER);
	activitySummary.revalidate();

}
 
開發者ID:tfreier,項目名稱:desktop-crm,代碼行數:26,代碼來源:CallWindow.java

示例6: main

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
public static void main(String[] args) {
    final JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    queryTextfield = new JTextField("#javaone");
    tweetwall = new EmbeddedTweetwall();

    final JFXPanel p = new JFXPanel();
    p.setScene(new Scene(new BorderPane(tweetwall)));

    queryTextfield.addActionListener(e -> {
        stop();
        start(queryTextfield.getText());
    });

    panel.add(queryTextfield, BorderLayout.NORTH);
    panel.add(p, BorderLayout.CENTER);

    JFrame jFrame = new JFrame("Hi there");
    jFrame.setContentPane(panel);
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jFrame.setSize(1024, 768);
    jFrame.setVisible(true);
}
 
開發者ID:TweetWallFX,項目名稱:TweetwallFX,代碼行數:25,代碼來源:Main.java

示例7: initFX

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private  void initFX(JFXPanel jfxPanel) {
    try {
        Parent root = FXMLLoader.load(getClass().getResource("email.fxml"));
        Scene scene = new Scene(root,500, 500);
        scene.getStylesheets().add(getClass().getResource("Login.css").toExternalForm());
        jfxPanel.setScene(scene);
    } catch (IOException exc) {
        exc.printStackTrace();
        System.exit(1);
    }
}
 
開發者ID:ksaluja24,項目名稱:scratch-bench,代碼行數:12,代碼來源:Login.java

示例8: initFX

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
/**
 * Init JFXPanel which serves as a bridge between Swing and JavaFX
 * 
 * @param fxPanel
 */
private void initFX(JFXPanel fxPanel) {
	// This method is invoked on the JavaFX thread
	Group root = new Group();
	Scene scene = new Scene(root, Color.ALICEBLUE);
	fxPanel.setScene(scene);
}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:12,代碼來源:DropzonePopOver.java

示例9: initFX

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private void initFX(JFXPanel fxPanel) {
    // This method is invoked on the JavaFX thread
    Group root = new Group();
    Scene scene = new Scene(root);
    fxPanel.setScene(scene);

}
 
開發者ID:PanagiotisDrakatos,項目名稱:Weather-Forecast,代碼行數:8,代碼來源:JFxBuilder.java

示例10: initFxLater

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
/**
 * initialize JavaFX
 *
 * @param jfxPanel
 */
private void initFxLater(JFXPanel jfxPanel) {
    if (!initialized) {
        synchronized (lock) {
            if (!initialized) {
                try {
                    final BorderPane rootNode = new BorderPane();
                    jfxPanel.setScene(new Scene(rootNode, 600, 600));

                    final Node main = createMainNode();
                    rootNode.setCenter(main);
                    BorderPane.setMargin(main, new Insets(3, 3, 3, 3));

                    String css = NotificationsInSwing.getControlStylesheetURL();
                    if (css != null)
                        jfxPanel.getScene().getStylesheets().add(css);
                    css = getControlStylesheetURL();
                    if (css != null) {
                        jfxPanel.getScene().getStylesheets().add(css);
                        spreadsheetView.getStylesheets().add(css);
                    }
                    columnContextMenu = new PopupMenuFX(GUIConfiguration.getAttributeColumnHeaderPopupConfiguration(), samplesViewer.getCommandManager());
                    rowContextMenu = new PopupMenuFX(GUIConfiguration.getSampleRowHeaderPopupConfiguration(), samplesViewer.getCommandManager());
                    originalRowContextMenuLength = rowContextMenu.getItems().size();
                } finally {
                    initialized = true;
                }
            }
        }
    }
}
 
開發者ID:danielhuson,項目名稱:megan-ce,代碼行數:36,代碼來源:SamplesSpreadSheet.java

示例11: runAndWait

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
/**
   * Runs code on the JavaFX Application Thread,
   * and then updates the panel's scene so that
   * it gets resized in the case that components
   * have been added or removed from the panel.
   *
   * @param panel the panel that the Runnable operates on.
   *              This parameter may be null.
   * @param runnable the Runnable whose run method will be
   *                 executed on the JavaFX Application Thread
   */
  public static void runAndWait(JFXPanel panel, Runnable runnable) {
      if (Platform.isFxApplicationThread()) {
          runnable.run();
      } else {
          CountDownLatch doneLatch = new CountDownLatch(1);

          Platform.runLater(() -> {
              try {
                  runnable.run();
              } finally {
                  doneLatch.countDown();
              }
          });

          try {
              doneLatch.await();
          } catch (InterruptedException ignored) {
          }
      }

/*
	Hacky way of making it so the
	panel will resize when components
	have been added or removed.
 */
      if (panel != null) {
          Scene scene = panel.getScene();
          panel.setScene(null);
          panel.setScene(scene);
      }
  }
 
開發者ID:Wingman,項目名稱:wingman,代碼行數:43,代碼來源:SkinManager.java

示例12: showConfirmDialog

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
public static boolean showConfirmDialog(String title, Node node) {
	if (Platform.isFxApplicationThread()) {
		Alert alert = new Alert(AlertType.NONE, null, ButtonType.OK, ButtonType.CANCEL);
		if (QuPathGUI.getInstance() != null)
			alert.initOwner(QuPathGUI.getInstance().getStage());
		alert.setTitle(title);
		alert.getDialogPane().setContent(node);
		Optional<ButtonType> result = alert.showAndWait();
		return result.isPresent() && result.get() == ButtonType.OK;
	} else {
		JFXPanel panel = new JFXPanel();
		panel.setScene(new Scene(new StackPane(node)));
		return JOptionPane.showConfirmDialog(null, panel, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION;
	}
}
 
開發者ID:qupath,項目名稱:qupath,代碼行數:16,代碼來源:DisplayHelpers.java

示例13: reset

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
public void reset() {
    if(isShown()) {
        setContent(null);
        panel = new JFXPanel();
        setContent(panel);
        if(aemdcScene == null) {
            Platform.runLater(() -> {
                initFX(project);
            });
        } else {
            panel.setScene(aemdcScene);
        }
        setBorder(BorderFactory.createLineBorder(java.awt.Color.BLACK, 1, false));
    }
}
 
開發者ID:headwirecom,項目名稱:aem-ide-tooling-4-intellij,代碼行數:16,代碼來源:AemdcPanel.java

示例14: initFX

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private void initFX(JFXPanel fxPanel) {
	// This method is invoked on the JavaFX thread
	try {
		Parent root = FXMLLoader.load(getClass().getResource("/com/me3tweaks/modmanager/ui/aboutwindow.fxml"));
		Scene scene = new Scene(root);
		Label version = (Label) scene.lookup("#versionLabel");
		version.setText("Version " + ModManager.VERSION + " - Build " + ModManager.BUILD_NUMBER + " - " + ModManager.BUILD_DATE);
		//Scene scene = createScene();
		fxPanel.setScene(scene);
	} catch (Exception e) {
		ModManager.debugLogger.writeErrorWithException("ERROR CREATING SCENE...", e);
	}
}
 
開發者ID:Mgamerz,項目名稱:me3modmanager,代碼行數:14,代碼來源:AboutWindow2.java

示例15: configureCircos

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
@Override
void configureCircos(JFXPanel jfxPanel) {
    Circos widget = new Circos(new long[]{34,56,90, 65, 10}, new ArcEventHandler(), new LinkEventHandler());
    widget.setStrokeWidth(1);
    widget.initialize();
    loadLinks(widget);
    widget.doFancyStuffs();
    
    circos.gui.Trials gui = new circos.gui.Trials(widget);
    jfxPanel.setScene(new Scene(gui));
}
 
開發者ID:paolopavan,項目名稱:circosFX,代碼行數:12,代碼來源:CircosZoomerTest.java


注:本文中的javafx.embed.swing.JFXPanel.setScene方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。