List of usage examples for java.awt GraphicsDevice isFullScreenSupported
public boolean isFullScreenSupported()
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); if (gs.isFullScreenSupported()) { // Full-screen mode is supported } else {// w w w .ja v a 2 s.com // Full-screen mode will be simulated } }
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);/* w w w.ja v a2 s.c o m*/ } 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);// w ww.ja v a 2s . c o m } 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:com.igormaznitsa.sciareto.ui.MainFrame.java
private void menuFullScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFullScreenActionPerformed final Component currentComponent = this.tabPane.getSelectedComponent(); if (!(currentComponent instanceof Container)) { LOGGER.warn("Detected attempt to full screen not a container : " + currentComponent); return;//w w w . ja va 2 s . c o m } final GraphicsConfiguration gconfig = this.getGraphicsConfiguration(); if (gconfig != null) { final GraphicsDevice device = gconfig.getDevice(); if (device.isFullScreenSupported()) { if (device.getFullScreenWindow() == null) { final JLabel label = new JLabel("Opened in full screen"); final int tabIndex = this.tabPane.getSelectedIndex(); this.tabPane.setComponentAt(tabIndex, label); final JWindow window = new JWindow(Main.getApplicationFrame()); window.setAlwaysOnTop(true); window.setContentPane((Container) currentComponent); endFullScreenIfActive(); final KeyEventDispatcher fullScreenEscCatcher = new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(@Nonnull final KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && (e.getKeyCode() == KeyEvent.VK_ESCAPE || e.getKeyCode() == KeyEvent.VK_F11)) { endFullScreenIfActive(); return true; } return false; } }; if (this.taskToEndFullScreen.compareAndSet(null, new Runnable() { @Override public void run() { try { window.dispose(); } finally { tabPane.setComponentAt(tabIndex, currentComponent); device.setFullScreenWindow(null); KeyboardFocusManager.getCurrentKeyboardFocusManager() .removeKeyEventDispatcher(fullScreenEscCatcher); } } })) { try { KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher(fullScreenEscCatcher); device.setFullScreenWindow(window); } catch (Exception ex) { LOGGER.error("Can't turn on full screen", ex); endFullScreenIfActive(); KeyboardFocusManager.getCurrentKeyboardFocusManager() .removeKeyEventDispatcher(fullScreenEscCatcher); } } else { LOGGER.error("Unexpected state, processor is not null!"); } } else { LOGGER.warn("Attempt to full screen device which already in full screen!"); } } else { LOGGER.warn("Device doesn's support full screen"); DialogProviderManager.getInstance().getDialogProvider() .msgWarn("The Device doesn't support full-screen mode!"); } } else { LOGGER.warn("Can't find graphics config for the frame"); } }
From source file:com.freedomotic.jfrontend.MainWindow.java
private void setFullscreenMode() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); if (gd.isFullScreenSupported()) { frameMap.setVisible(false);/*from w ww . j av a 2s . c om*/ menuBar.setVisible(false); frameMap.dispose(); frameClient.setVisible(false); frameClient.dispose(); desktopPane.removeAll(); desktopPane.moveToBack(this); setVisible(false); dispose(); setUndecorated(true); setResizable(false); setLayout(new BorderLayout()); drawer = master.createRenderer(drawer.getCurrEnv()); if (drawer != null) { setDrawer(drawer); } else { LOG.error( "Unable to create a drawer to render the environment on the desktop frontend in fullscreen mode"); } add(drawer); Rectangle maximumWindowBounds = ge.getMaximumWindowBounds(); setBounds(maximumWindowBounds); drawer.setVisible(true); this.setVisible(true); gd.setFullScreenWindow(this); isFullscreen = true; Callout callout = new Callout(this.getClass().getCanonicalName(), "info", i18n.msg("esc_to_exit_fullscreen"), 100, 100, 0, 5000); drawer.createCallout(callout); } }
From source file:org.rdv.datapanel.AbstractDataPanel.java
/** * Undock the UI component and display fullscreen. * //from w w w .j a v a 2 s. c o m * @since 1.1 */ void maximizePanel() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); for (int i = 0; i < devices.length; i++) { GraphicsDevice device = devices[i]; if (device.isFullScreenSupported() && device.getFullScreenWindow() == null) { maximized = true; dataPanelContainer.removeDataPanel(component); frame = new JFrame(getTitle()); frame.setUndecorated(true); frame.getContentPane().add(component); try { device.setFullScreenWindow(frame); } catch (InternalError e) { log.error("Failed to switch to full screen mode: " + e.getMessage() + "."); restorePanel(true); return; } frame.setVisible(true); frame.requestFocus(); return; } } log.warn("No screens available or full screen exclusive mode is unsupported on your platform."); }
From source file:org.rdv.datapanel.AbstractDataPanel.java
/** * Leave fullscreen mode and dock the UI component if addToContainer is true. * // w w w . j a v a 2 s . co m * @param addToContainer whether to dock the UI component * @since 1.1 */ void restorePanel(boolean addToContainer) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); for (int i = 0; i < devices.length; i++) { GraphicsDevice device = devices[i]; if (device.isFullScreenSupported() && device.getFullScreenWindow() == frame) { if (frame != null) { frame.setVisible(false); device.setFullScreenWindow(null); frame.getContentPane().remove(component); frame.dispose(); frame = null; } maximized = false; if (addToContainer) { dataPanelContainer.addDataPanel(component); } break; } } }
From source file:org.rdv.ui.MainPanel.java
private boolean enterFullScreenMode() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); for (int i = 0; i < devices.length; i++) { GraphicsDevice device = devices[i]; if (device.isFullScreenSupported() && device.getFullScreenWindow() == null) { log.info("Switching to full screen mode."); frame.setVisible(false);//w w w . j a va 2 s . c om try { device.setFullScreenWindow(frame); } catch (InternalError e) { log.error("Failed to switch to full screen exclusive mode."); e.printStackTrace(); frame.setVisible(true); return false; } frame.dispose(); frame.setUndecorated(true); frame.setVisible(true); frame.requestFocusInWindow(); return true; } } log.warn("No screens available or full screen exclusive mode is unsupported on your platform."); postError("Full screen mode is not supported on your platform."); return false; }
From source file:org.rdv.ui.MainPanel.java
private void leaveFullScreenMode() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); for (int i = 0; i < devices.length; i++) { GraphicsDevice device = devices[i]; if (device.isFullScreenSupported() && device.getFullScreenWindow() == frame) { log.info("Leaving full screen mode."); frame.setVisible(false);// w w w .j a v a 2 s. c o m device.setFullScreenWindow(null); frame.dispose(); frame.setUndecorated(false); frame.setVisible(true); break; } } }
From source file:org.simmi.GeneSetHead.java
License:asdf
public void initFSKeyListener(final Window window) { keylistener = new KeyListener() { @Override/*from www . j a v a 2 s . com*/ public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); if (e.getKeyCode() == KeyEvent.VK_F11 && gd.isFullScreenSupported()) { Window w = gd.getFullScreenWindow(); if (w != null) { gd.setFullScreenWindow(null); } else { gd.setFullScreenWindow(window); } } } }; }