javafx.embed.swing.JFXPanel Java Examples
The following examples show how to use
javafx.embed.swing.JFXPanel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentsTest.java From netbeans with Apache License 2.0 | 7 votes |
@Test(timeOut = 9000) public void loadFX() throws Exception { final CountDownLatch cdl = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final JFXPanel p = new JFXPanel(); Platform.runLater(new Runnable() { @Override public void run() { Node wv = TestPages.getFX(10, cdl); Scene s = new Scene(new Group(wv)); p.setScene(s); done.countDown(); } }); done.await(); JFrame f = new JFrame(); f.getContentPane().add(p); f.pack(); f.setVisible(true); cdl.await(); }
Example #2
Source File: Main.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static void startupWithGUI() { // configure the UI before any type of user prompting may take place configureUI(); validateEnvironment(true); loadProperties(true); initPrintPreviewFonts(); new JFXPanel(); PCGenPreloader splash = new PCGenPreloader(); PCGenTaskExecutor executor = new PCGenTaskExecutor(); executor.addPCGenTask(createLoadPluginTask()); executor.addPCGenTask(new GameModeFileLoader()); executor.addPCGenTask(new CampaignFileLoader()); executor.addPCGenTaskListener(splash); executor.run(); splash.getController().setProgress(LanguageBundle.getString("in_taskInitUi"), 1.0d); FacadeFactory.initialize(); PCGenUIManager.initializeGUI(); splash.done(); PCGenUIManager.startGUI(); }
Example #3
Source File: Main.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static void startupWithGUI() { // configure the UI before any type of user prompting may take place configureUI(); validateEnvironment(true); loadProperties(true); initPrintPreviewFonts(); new JFXPanel(); PCGenPreloader splash = new PCGenPreloader(); PCGenTaskExecutor executor = new PCGenTaskExecutor(); executor.addPCGenTask(createLoadPluginTask()); executor.addPCGenTask(new GameModeFileLoader()); executor.addPCGenTask(new CampaignFileLoader()); executor.addPCGenTaskListener(splash); executor.run(); splash.getController().setProgress(LanguageBundle.getString("in_taskInitUi"), 1.0d); FacadeFactory.initialize(); PCGenUIManager.initializeGUI(); splash.done(); PCGenUIManager.startGUI(); }
Example #4
Source File: DialogsTest.java From netbeans with Apache License 2.0 | 6 votes |
@BeforeClass(timeOut = 9000) public static void initializeContext() throws Exception { final JFXPanel p = new JFXPanel(); final URL u = DialogsTest.class.getResource("/org/netbeans/api/htmlui/empty.html"); Platform.runLater(new Runnable() { @Override public void run() { WebView v = new WebView(); Scene s = new Scene(v); p.setScene(s); HtmlToolkit.getDefault().load(v, u, new Runnable() { @Override public void run() { ctx = BrwsrCtx.findDefault(DialogsTest.class); down.countDown(); } }, null); } }); down.await(); JFrame f = new JFrame(); f.getContentPane().add(p); f.pack(); f.setVisible(true); }
Example #5
Source File: VideoView.java From BotLibre with Eclipse Public License 1.0 | 6 votes |
public void setVideoView() { Platform.runLater(new Runnable() { @Override public void run() { final DoubleProperty width = mediaView.fitWidthProperty(); final DoubleProperty height = mediaView.fitHeightProperty(); width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width")); height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); BorderPane borderPane = new BorderPane(); borderPane.setCenter(mediaView); final Scene scene = new Scene(borderPane, Color.WHITE); ((JFXPanel) VideoView.jfx).setScene(scene); } }); this.component = jfx; }
Example #6
Source File: PCGenFrame.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private void initComponents() { setLayout(new BorderLayout()); JComponent root = getRootPane(); root.setActionMap(actionMap); root.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(actionMap)); characterTabs.add(new InfoGuidePane(this, uiContext)); setJMenuBar(pcGenMenuBar); PCGenToolBar pcGenToolBar = new PCGenToolBar(this); ToolBar toolBar = pcGenToolBar.buildMenu(); JFXPanel wrappedToolBar = GuiUtility.wrapParentAsJFXPanel(toolBar); add(wrappedToolBar, BorderLayout.NORTH); add(characterTabs, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); updateTitle(); setIconImage(Icons.PCGenApp.getImageIcon().getImage()); }
Example #7
Source File: JavaFXThreadingRule.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
protected void setupJavaFX() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { // initializes JavaFX environment new JFXPanel(); } finally { // always invoke countDown(), because otherwise the main thread will hang. latch.countDown(); } } }); latch.await(); }
Example #8
Source File: VideoView.java From BotLibre with Eclipse Public License 1.0 | 6 votes |
public void setVideoView() { Platform.runLater(new Runnable() { @Override public void run() { final DoubleProperty width = mediaView.fitWidthProperty(); final DoubleProperty height = mediaView.fitHeightProperty(); width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width")); height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); BorderPane borderPane = new BorderPane(); borderPane.setCenter(mediaView); final Scene scene = new Scene(borderPane, Color.WHITE); ((JFXPanel) VideoView.jfx).setScene(scene); } }); this.component = jfx; }
Example #9
Source File: FXBrowserWindowSE.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public FXBrowserWindowSE(String startURL) { try { initUI(startURL); } catch (IllegalStateException ex) { try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { new JFXPanel(); } }); } catch (InterruptedException iex) { Log.e(iex); throw ex; } catch (InvocationTargetException ite) { Log.e(ite); throw ex; } initUI(startURL); } }
Example #10
Source File: PCGenStatusBar.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
PCGenStatusBar(PCGenFrame frame) { this.frame = frame; this.messageLabel = new JLabel(); this.progressBar = new JProgressBar(); this.loadStatusButton = new Button(); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(messageLabel); add(Box.createHorizontalGlue()); progressBar.setStringPainted(true); progressBar.setVisible(false); add(progressBar); add(Box.createHorizontalGlue()); JFXPanel wrappedButton = GuiUtility.wrapParentAsJFXPanel(loadStatusButton); //todo: calculate this rather than hard code wrappedButton.setMaximumSize(new Dimension(750, 20000000)); add(wrappedButton); loadStatusButton.setOnAction(this::loadStatusLabelAction); }
Example #11
Source File: StockChartWindow.java From Rails with GNU General Public License v2.0 | 6 votes |
public StockChartWindow(GameUIManager gameUIManager) { final JFXPanel fxPanel = new JFXPanel(); add(fxPanel); setTitle("Rails: Stock Chart"); setPreferredSize(new Dimension(600, 400)); setVisible(true); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); final JFrame frame = this; addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { gameUIManager.uncheckMenuItemBox(StatusWindow.REPORT_CMD); frame.dispose(); } }); Platform.runLater(() -> { Scene scene = new Scene(new FXStockChart(gameUIManager)); fxPanel.setScene(scene); frame.pack(); }); }
Example #12
Source File: Main.java From TweetwallFX with MIT License | 6 votes |
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); }
Example #13
Source File: WebContentFXPanel.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public WebContentFXPanel() { Platform.setImplicitExit(false); panel = new JFXPanel(); setContent(panel); String actualUrl = url; try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); if (response.getStatusLine().getStatusCode() != 200) { actualUrl = altUrl; } } catch(IOException e) { // Ignore } final String targetUrl = actualUrl; Platform.runLater(() -> { initFX(targetUrl); }); }
Example #14
Source File: FXInSwing.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public FXInSwing(){ panel = new JFXPanel(); Platform.runLater(new Runnable(){ @Override public void run() { stack = new StackPane(); scene = new Scene(stack,300,300); hello = new Text("Hello"); scene.setFill(Color.BLACK); hello.setFill(Color.WHEAT); hello.setEffect(new Reflection()); panel.setScene(scene); stack.getChildren().add(hello); wait = false; } }); this.getContentPane().add(panel); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(300, 300); this.setVisible(true); }
Example #15
Source File: SwingDialog.java From mars-sim with GNU General Public License v3.0 | 6 votes |
private JFXPanel createJFXPanel(){ final JFXPanelEx panel = new JFXPanelEx(); Platform.runLater(new Runnable() { @Override public void run() { final VBox vbox = new VBox(); final ComboBox<String> combo = new ComboBox<String>(); for (int i = 0; i< 101; i++){ combo.getItems().add("text" + i); } vbox.getChildren().addAll(combo); final Scene scene = new Scene(vbox); panel.setScene(scene); }; }); return panel; }
Example #16
Source File: SwingDialog.java From mars-sim with GNU General Public License v3.0 | 6 votes |
private JFXPanel createJFXPanel0(){ final JFXPanel panel = new JFXPanel(); Platform.runLater(new Runnable() { @Override public void run() { final VBox vbox = new VBox(); final ComboBox<String> combo = new ComboBox<String>(); for (int i = 0; i< 101; i++){ combo.getItems().add("text" + i); } vbox.getChildren().addAll(combo); final Scene scene = new Scene(vbox); panel.setScene(scene); }; }); return panel; }
Example #17
Source File: SwingFXWebView.java From mars-sim with GNU General Public License v3.0 | 6 votes |
private void initComponents(){ jfxPanel = new JFXPanel(); createScene(); setLayout(new BorderLayout()); add(jfxPanel, BorderLayout.CENTER); swingButton = new JButton(); swingButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Platform.runLater(new Runnable() { @Override public void run() { webEngine.reload(); } }); } }); swingButton.setText("Reload"); add(swingButton, BorderLayout.SOUTH); }
Example #18
Source File: SwingFXWebView.java From opencards with BSD 2-Clause "Simplified" License | 6 votes |
private void initComponents() { jfxPanel = new JFXPanel(); createScene(); setLayout(new BorderLayout()); add(jfxPanel, BorderLayout.CENTER); swingButton = new JButton(); swingButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Platform.runLater(new Runnable() { @Override public void run() { webEngine.reload(); } }); } }); swingButton.setText("Reload"); add(swingButton, BorderLayout.SOUTH); }
Example #19
Source File: PCGenFrame.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private void initComponents() { setLayout(new BorderLayout()); JComponent root = getRootPane(); root.setActionMap(actionMap); root.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(actionMap)); characterTabs.add(new InfoGuidePane(this, uiContext)); setJMenuBar(pcGenMenuBar); PCGenToolBar pcGenToolBar = new PCGenToolBar(this); ToolBar toolBar = pcGenToolBar.buildMenu(); JFXPanel wrappedToolBar = GuiUtility.wrapParentAsJFXPanel(toolBar); add(wrappedToolBar, BorderLayout.NORTH); add(characterTabs, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); updateTitle(); setIconImage(Icons.PCGenApp.getImageIcon().getImage()); }
Example #20
Source File: SamplesTableView.java From megan-ce with GNU General Public License v3.0 | 6 votes |
/** * initialize JavaFX * * @param jfxPanel */ private void initFxLater(JFXPanel jfxPanel) { if (!initialized) { if (Thread.getDefaultUncaughtExceptionHandler() != fxExceptionHandler) Thread.setDefaultUncaughtExceptionHandler(fxExceptionHandler); 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); } finally { initialized = true; } } } } }
Example #21
Source File: PCGenStatusBar.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
PCGenStatusBar(PCGenFrame frame) { this.frame = frame; this.messageLabel = new JLabel(); this.progressBar = new JProgressBar(); this.loadStatusButton = new Button(); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(messageLabel); add(Box.createHorizontalGlue()); progressBar.setStringPainted(true); progressBar.setVisible(false); add(progressBar); add(Box.createHorizontalGlue()); JFXPanel wrappedButton = GuiUtility.wrapParentAsJFXPanel(loadStatusButton); //todo: calculate this rather than hard code wrappedButton.setMaximumSize(new Dimension(750, 20000000)); add(wrappedButton); loadStatusButton.setOnAction(this::loadStatusLabelAction); }
Example #22
Source File: JavaFXThreadingRule.java From PeerWasp with MIT License | 6 votes |
protected void setupJavaFX() throws InterruptedException { long timeMillis = System.currentTimeMillis(); final CountDownLatch latch = new CountDownLatch(1); SwingUtilities.invokeLater(new Runnable() { public void run() { // initializes JavaFX environment new JFXPanel(); latch.countDown(); } }); logger.info("javafx initialising..."); latch.await(); logger.info("javafx is initialised in " + (System.currentTimeMillis() - timeMillis) + "ms"); }
Example #23
Source File: MacMainMenuHybrid.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
public MacMainMenuHybrid() { this.setLayout( new FlowLayout(FlowLayout.CENTER) ); JMenuBar menubar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); JMenu helpMenu = new JMenu("Help"); JMenuItem closeItem = new JMenuItem("Close"); closeItem.addActionListener((evt) -> { Platform.exit(); System.exit(0); }); fileMenu.add( closeItem ); menubar.add( fileMenu ); menubar.add( editMenu ); menubar.add( helpMenu ); this.setJMenuBar(menubar); try { JFXPanel mainFXWindow = createMainFXWindow(); this.getContentPane().add( mainFXWindow ); } catch(Exception exc) { exc.printStackTrace(); System.exit(1); } }
Example #24
Source File: ScrLexicon.java From PolyGlot with MIT License | 5 votes |
/** * Creates new form scrLexicon * * @param _core Dictionary Core * @param _menuParent */ public ScrLexicon(DictCore _core, ScrMainMenu _menuParent) { super(_core); defTypeValue.setValue("-- Part of Speech --"); defTypeValue.setId(-1); defRootValue.setValue("-- Root --"); defRootValue.setId(-1); menuParent = _menuParent; fxPanel = new JFXPanel(); txtRom = new PTextField(core, true, "-- Romanization --"); txtRom.setToolTipText("Romanized representation of word"); initComponents(); lstLexicon.setModel(new PListModelLexicon()); setupFilterMenu(); setupComboBoxesSwing(); setDefaultValues(); populateLexicon(); lstLexicon.setSelectedIndex(0); populateProperties(); setupListeners(); setCustomLabels(); }
Example #25
Source File: GuiUtility.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
/** * During the conversion to JavaFX we have a mix of JavaFX and Swing components * This provides a way to convert from JavaFX to Swing. * Note that the painting happens "eventually" and thus when the function returned * there is no guarantee that the component has any size yet. * @param parent a javafx Parent to be shown as a swing node * @return a jfxpanel that eventually gets painted as the parent container */ public static JFXPanel wrapParentAsJFXPanel(Parent parent) { GuiAssertions.assertIsNotJavaFXThread(); JFXPanel jfxPanel = new JFXPanel(); Platform.runLater(() -> { Scene scene = new Scene(parent); jfxPanel.setScene(scene); }); return jfxPanel; }
Example #26
Source File: MockCanvasManager.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
public MockCanvasManager(Configuration config) { super(new Group(), new ShootOFFController(), String.format("%d", System.nanoTime()), FXCollections.observableArrayList()); new JFXPanel(); // Initialize the JFX toolkit this.config = config; this.cameraName = "Default"; this.useShotProcessors = false; }
Example #27
Source File: BrowseButton.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public void browse(File from) { DirectoryChooser folderChooser = new DirectoryChooser(); folderChooser.setInitialDirectory(from); new JFXPanel(); // Init JFX Platform Platform.runLater(() -> { File file = folderChooser.showDialog(null); if (file != null && file.exists()) { File parent = file.getParentFile(); if (parent == null) parent = file; Preferences.userRoot().node(Fawe.class.getName()).put("LAST_USED_FOLDER" + id, parent.getPath()); onSelect(file); } }); }
Example #28
Source File: MacMainMenuHybrid.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
private JFXPanel createMainFXWindow() throws Exception { JFXPanel jfxPanel = new JFXPanel(); // initializes the toolkit FXMLLoader fxmlLoader = new FXMLLoader( this.getClass().getResource("/macmenu-fxml/MacMenu.fxml") ); fxmlLoader.load(); Parent p = fxmlLoader.getRoot(); Scene scene = new Scene(p); jfxPanel.setScene( scene ); return jfxPanel; }
Example #29
Source File: PluginParametersSwingDialog.java From constellation with Apache License 2.0 | 5 votes |
/** * Display a dialog box containing the parameters that allows the user to * enter values. * <p> * "OK" and "Cancel" (and "Help" if helpID is non-null) buttons are * displayed. * * @param title The dialog box title. * @param parameters The plugin parameters. * @param excludedParameters Plugin parameters to exclude from the dialog * box. * @param helpID The JavaHelp ID of the help. */ public PluginParametersSwingDialog(final String title, final PluginParameters parameters, final Set<String> excludedParameters, final String helpID) { // if(!SwingUtilities.isEventDispatchThread()) // { // throw new IllegalStateException("Not event dispatch thread"); // } this.title = title; final CountDownLatch latch = new CountDownLatch(1); xp = helpID != null ? new JFXPanelWithHelp(helpID) : new JFXPanel(); Platform.runLater(() -> { final BorderPane root = new BorderPane(); root.setPadding(new Insets(10)); root.setStyle("-fx-background-color: #DDDDDD;"); // Attempt to give the window a sensible width and/or height. root.setMinWidth(500); final PluginParametersPane parametersPane = PluginParametersPane.buildPane(parameters, null, excludedParameters); root.setCenter(parametersPane); final Scene scene = new Scene(root); xp.setScene(scene); xp.setPreferredSize(new Dimension((int) scene.getWidth(), (int) scene.getHeight())); latch.countDown(); }); try { latch.await(); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); Thread.currentThread().interrupt(); } }
Example #30
Source File: RadioChooserDialog.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private void initComponents() { Pane outerPane = new VBox(); JFXPanel jfxPanel = new JFXPanel(); jfxPanel.setLayout(new BorderLayout()); setTitle(LanguageBundle.getString("in_chooserSelectOne")); //$NON-NLS-1$ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Node titleLabel = new Text(chooser.getName()); titleLabel.getStyleClass().add("chooserTitle"); URL applicationCss = getClass().getResource("/pcgen/gui3/application.css"); String asString = applicationCss.toExternalForm(); outerPane.getStylesheets().add(asString); outerPane.getChildren().add(titleLabel); toggleGroup = new ToggleGroup(); outerPane.getChildren().add(buildButtonPanel()); this.getContentPane().setLayout(new GridLayout()); this.getContentPane().add(jfxPanel, BorderLayout.CENTER); ButtonBar buttonBar = new OKCloseButtonBar( this::onOK, this::onCancel); outerPane.getChildren().add(buttonBar); Platform.runLater(() -> { Scene scene = new Scene(outerPane); jfxPanel.setScene(scene); SwingUtilities.invokeLater(this::pack); }); }