In my Java application I try to make a JFrame really fullscreen by using this code:
public class MainFrame extends JFrame {
private static final long se
An example:
import java.awt.FlowLayout;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class FullScreenJFrame extends JFrame{
private GraphicsDevice vc;
public FullScreenJFrame(){
super();
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
vc= e.getDefaultScreenDevice();
JButton b = new JButton("exit");
b.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
dispose();
System.exit(0);
}
}
);
this.setLayout(new FlowLayout());
this.add(b);
setFullScreen(this);
}
public void setFullScreen(JFrame f){
f.setUndecorated(true);
f.setResizable(false);
vc.setFullScreenWindow(f);
}
public static void main(String[] args){
new FullScreenJFrame();
}
}