-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
fx2.0
-
Windows XP SP3
Java SDK 1.6.0_26
JavaFX 2.0 Beta 32bit SDK downloaded 20 June 2011
We would like to use some pieces of JavaFX in our existing Swing application. Porting everything to JavaFX is not an option right now. The application is fullscreen which seems to cause the Swing integration to fail. I've created a small sample that reproduces the problem.
I have a simple JFXPanel with a WebView (tried to replace it with a Button and the result is the same) in a JFrame. As long as the JFrame is not set in fullscreen mode everything works fine, but when I add the following code the area were the JFXPanel is remains grey.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
gs.setFullScreenWindow(frame);
For completness I am adding the entire code that I used to reproduce the problem.
import javafx.application.Application;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
public class MainTest extends Application {
private static JFXPanel javafxPanel;
private void initAndShowFrame() {
JFrame frame = new JFrame("JxBrowser");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
javafxPanel = new JFXPanel();
javafxPanel.setPreferredSize(new Dimension(1024,800));
frame.getContentPane().add(javafxPanel, BorderLayout.CENTER);
// Create JavaFX scene.
Application.launch(MainTest.class, null);
frame.setVisible(true);
frame.setSize(new Dimension(1024, 800));
// if these following 3 lines are commented out, everything works fine.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
gs.setFullScreenWindow(frame);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MainTest jxBrowser = new MainTest();
jxBrowser.initAndShowFrame();
}
});
}
public void start(final Stage stage) throws Exception {
//Create the scene and the stage
Group root = new Group();
final Scene scene = new Scene(root);
final WebEngine webEngine = new WebEngine();
WebView webView = new WebView(webEngine);
webEngine.load("http://www.oracle.com");
root.getChildren().add(webView);
// Add scene to panel
javafxPanel.setScene(scene);
}
}
I have a simple JFXPanel with a WebView (tried to replace it with a Button and the result is the same) in a JFrame. As long as the JFrame is not set in fullscreen mode everything works fine, but when I add the following code the area were the JFXPanel is remains grey.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
gs.setFullScreenWindow(frame);
For completness I am adding the entire code that I used to reproduce the problem.
import javafx.application.Application;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
public class MainTest extends Application {
private static JFXPanel javafxPanel;
private void initAndShowFrame() {
JFrame frame = new JFrame("JxBrowser");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
javafxPanel = new JFXPanel();
javafxPanel.setPreferredSize(new Dimension(1024,800));
frame.getContentPane().add(javafxPanel, BorderLayout.CENTER);
// Create JavaFX scene.
Application.launch(MainTest.class, null);
frame.setVisible(true);
frame.setSize(new Dimension(1024, 800));
// if these following 3 lines are commented out, everything works fine.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
gs.setFullScreenWindow(frame);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MainTest jxBrowser = new MainTest();
jxBrowser.initAndShowFrame();
}
});
}
public void start(final Stage stage) throws Exception {
//Create the scene and the stage
Group root = new Group();
final Scene scene = new Scene(root);
final WebEngine webEngine = new WebEngine();
WebView webView = new WebView(webEngine);
webEngine.load("http://www.oracle.com");
root.getChildren().add(webView);
// Add scene to panel
javafxPanel.setScene(scene);
}
}
- duplicates
-
JDK-8089220 set fullscreen in swing and embed javafx doesn't display anything
- Open
- is blocked by
-
JDK-8111822 Need to disable java2d.d3d when D3D and OpenGL pipelines selected.
- Closed