Hello all,
I’m having a bit of a problem with full-screen exclusive mode. It properly goes into full-screen but whenever I press Alt-Tab to switch to another window then go back to my full-screen application, it doesn’t go back into full-screen and the application doesn’t show up.
Here’s my code:
import java.awt.*;
import javax.swing.*;
public class Test extends JPanel {
public Test() {
}
public void paintComponent(Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, 800, 600);
g.setColor(Color.white);
g.drawString("This is a fullscreen test.", 100, 100);
}
public static void main(String args[]) {
JFrame w = new JFrame("FullScreen Test");
w.setSize(800, 600);
w.setResizable(false);
w.setUndecorated(true);
w.setContentPane(new Test());
w.setDefaultCloseOperation(w.EXIT_ON_CLOSE);
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
gd.setFullScreenWindow(w);
w.setVisible(true);
}
}
What am I doing wrong here? Is there any way to fix this?