List of usage examples for java.awt GraphicsDevice setFullScreenWindow
public void setFullScreenWindow(Window w)
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); gs.setFullScreenWindow(null); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(800, 600);//from ww w . j a va 2 s . c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); device.setFullScreenWindow(frame); device.setDisplayMode(new DisplayMode(800, 600, 32, 60)); frame.setVisible(true); JButton btn = new JButton(); btn.setText("Button"); JPanel panel = new JPanel(); panel.add(btn); frame.add(panel); btn.addActionListener(e -> { JOptionPane.showMessageDialog(frame.getContentPane(), "JOptionPane"); }); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); device.setFullScreenWindow(frame); device.setDisplayMode(new DisplayMode(800, 600, 32, 60)); frame.addWindowListener(new WindowAdapter() { @Override//from w w w . j av a2 s .c o m public void windowIconified(WindowEvent we) { if (programmatic) { programmatic = false; frame.setState(JFrame.NORMAL); } } }); JButton btn = new JButton(); btn.setText("Btn"); final JPanel panel = new JPanel(); panel.add(btn); frame.add(panel); btn.addActionListener(e -> { programmatic = true; JOptionPane.showMessageDialog(panel, "Sample"); }); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice vc = env.getDefaultScreenDevice(); JFrame window = new JFrame(); JPanel comp = new JPanel(); comp.setBackground(Color.RED); window.add(comp);//from w w w. ja va 2s.c om window.setUndecorated(true); window.setResizable(false); vc.setFullScreenWindow(window); }
From source file:Main.java
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = ge.getDefaultScreenDevice(); if (!screen.isFullScreenSupported()) { System.out.println("Full screen mode not supported"); System.exit(1);//from w w w . j a v a2 s . c om } try { BufferedImage loadedpic = ImageIO.read(new File("your.jpg")); screen.setFullScreenWindow(new Main(loadedpic)); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:MainClass.java
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = ge.getDefaultScreenDevice(); if (!screen.isFullScreenSupported()) { System.out.println("Full screen mode not supported"); System.exit(1);/*from w w w . ja v a 2 s . c om*/ } try { BufferedImage loadedpic = ImageIO.read(new File("your.jpg")); screen.setFullScreenWindow(new MainClass(loadedpic)); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); Button btn = new Button("OK"); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); gs.setFullScreenWindow(null); }/* ww w . j a v a 2 s . com*/ }); Frame frame = new Frame(gs.getDefaultConfiguration()); Window win = new Window(frame); win.add(btn, BorderLayout.CENTER); try { gs.setFullScreenWindow(win); win.validate(); } finally { gs.setFullScreenWindow(null); } }
From source file:FullScreen.java
public static void main(String args[]) { GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice(); DisplayMode originalDisplayMode = graphicsDevice.getDisplayMode(); try {//from w ww . j ava 2 s . c o m Frame frame = new Frame(); frame.setUndecorated(true); frame.setIgnoreRepaint(true); graphicsDevice.setFullScreenWindow(frame); if (graphicsDevice.isDisplayChangeSupported()) { graphicsDevice.setDisplayMode(getBestDisplayMode(graphicsDevice)); } frame.createBufferStrategy(2); // 2 buffers Rectangle bounds = frame.getBounds(); BufferStrategy bufferStrategy = frame.getBufferStrategy(); while (!done()) { Graphics g = null; try { g = bufferStrategy.getDrawGraphics(); if ((counter <= 2)) { // 2 buffers g.setColor(Color.CYAN); g.fillRect(0, 0, bounds.width, bounds.height); } g.setColor(Color.RED); // redraw prior line, too, since 2 buffers if (counter != 1) { g.drawLine(counter - 1, (counter - 1) * 5, bounds.width, bounds.height); } g.drawLine(counter, counter * 5, bounds.width, bounds.height); bufferStrategy.show(); } finally { if (g != null) { g.dispose(); } } try { Thread.sleep(250); } catch (InterruptedException ignored) { } } } finally { graphicsDevice.setDisplayMode(originalDisplayMode); graphicsDevice.setFullScreenWindow(null); } System.exit(0); }
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); boolean canChg = gs.isDisplayChangeSupported(); if (canChg) { DisplayMode displayMode = gs.getDisplayMode(); int screenWidth = 640; int screenHeight = 480; int bitDepth = 8; displayMode = new DisplayMode(screenWidth, screenHeight, bitDepth, displayMode.getRefreshRate()); try {//from www .j a v a 2 s . c o m gs.setDisplayMode(displayMode); } catch (Throwable e) { gs.setFullScreenWindow(null); } } }
From source file:Main.java
public static void main(String[] args) { String TITLE = "Full Screen Test"; JFrame f = new JFrame(TITLE); JDesktopPane jdp = new JDesktopPane(); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice dev = env.getDefaultScreenDevice(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JInternalFrame jif = new JInternalFrame(TITLE, true, true, true); jif.add(new JLabel(TITLE + " " + TITLE), BorderLayout.NORTH); jif.add(new JLabel(TITLE + " " + TITLE), BorderLayout.CENTER); jif.add(new JLabel(TITLE + " " + TITLE), BorderLayout.SOUTH); jif.pack();/*from ww w.j a va 2 s . co m*/ jif.setLocation(100, 100); jif.setVisible(true); jdp.add(jif); f.add(jdp, BorderLayout.CENTER); dev.setFullScreenWindow(f); }