Guest User

Untitled

a guest
May 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. public class FullScreenTest
  2. {
  3.    
  4.     GraphicsDevice device;
  5.    
  6.     public FullScreenTest()
  7.     {
  8.         GraphicsEnvironment ge = GraphicsEnvironment
  9.                 .getLocalGraphicsEnvironment();
  10.         device = ge.getDefaultScreenDevice();
  11.         GraphicsConfiguration gc = device
  12.                 .getDefaultConfiguration();
  13.        
  14.         try {
  15.             JFrame frame = new JFrame(gc);
  16.             frame.setUndecorated(true);
  17.            
  18.             JButton button = new JButton("OK");
  19.             button.addActionListener(new ActionListener()
  20.             {
  21.                 public void actionPerformed(ActionEvent e)
  22.                 {
  23.                     device.setFullScreenWindow(null);
  24.                     System.exit(0);
  25.                 }
  26.             });
  27.            
  28.             frame.getContentPane().add(button);
  29.             device.setFullScreenWindow(frame);
  30.             frame.setVisible(true);
  31.         } catch (Exception ex) {
  32.             device.setFullScreenWindow(null);
  33.             System.exit(0);
  34.         }
  35.     }
  36.    
  37.     public static void main(String[] args)
  38.     {
  39.         FullScreenTest test = new FullScreenTest();
  40.     }
  41. }
Add Comment
Please, Sign In to add comment