本文整理汇总了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);
}
示例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;
}
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
}
}
}
}
示例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);
}
}
示例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;
}
}
示例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));
}
}
示例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);
}
}
示例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));
}