Hi there,
I make a JOGL program, and when I set the JFrame to full screen mode, every objects I loaded are gone.
In my program, I use a JPanel and add the JPanel to a JFrame using the following code.
jframe.getContentPane().setLayout( new BorderLayout() );
jframe.getContentPane().add(makeRenderPanel(period), BorderLayout.CENTER);
jframe.addWindowListener(this);
I use the following function to set JFrame to full screen.
public void setFullScreen(DisplayMode displayMode) {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setIgnoreRepaint(true);
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
device.setFullScreenWindow(frame);
if (displayMode != null &&
device.isDisplayChangeSupported())
{
try {
device.setDisplayMode(displayMode);
}
catch (IllegalArgumentException ex) { }
frame.setSize(displayMode.getWidth(),
displayMode.getHeight());
}
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
frame.createBufferStrategy(2);
}
});
}
catch (InterruptedException ex) {
// ignore
}
catch (InvocationTargetException ex) {
// ignore
}
}
I get quite confused about this problem. Is there anyone who can help me with this?
Thank you very much!