import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class FullScreenTest1 {

    GraphicsDevice device;

    public FullScreenTest1(){
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        device = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = device.getDefaultConfiguration();
            
        try{
            JFrame frame = new JFrame(gc);
            frame.setUndecorated(true);

            JButton button = new JButton("OK");
            button.addActionListener(new ActionListener(){
                    public void actionPerformed(ActionEvent e){
                        device.setFullScreenWindow(null);
                        System.exit(0);
                    }
                });
            
            frame.getContentPane().add(button);
            device.setFullScreenWindow(frame);
	    frame.setVisible(true);
        }catch(Exception ex){
            device.setFullScreenWindow(null);
            System.exit(0);
        }
    }

    public static void main(String[] args){
        FullScreenTest1 test = new FullScreenTest1();
    }
}

