GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight();
public static DisplayMode[] getDisplayModes () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode desktopMode = device.getDisplayMode(); java.awt.DisplayMode[] displayModes = device.getDisplayModes(); ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>(); int idx = 0; for (java.awt.DisplayMode mode : displayModes) { boolean duplicate = false; for (int i = 0; i < modes.size(); i++) { if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) { duplicate = true; break; } } if (duplicate) continue; if (mode.getBitDepth() != desktopMode.getBitDepth()) continue; modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode .getBitDepth())); } return modes.toArray(new DisplayMode[modes.size()]); } }
public void setLocationAndPosition() { if (this.settings.loadWindowPos(this)) { return; } GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); DisplayMode mode = gd.getDisplayMode(); int w = mode.getWidth(); int h = mode.getHeight(); setLocation((int) (w * BORDER_RATIO), (int) (h * BORDER_RATIO)); setSize((int) (w * WINDOW_RATIO), (int) (h * WINDOW_RATIO)); }
public static DisplayMode[] getDisplayModes () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode desktopMode = device.getDisplayMode(); java.awt.DisplayMode[] displayModes = device.getDisplayModes(); ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>(); int idx = 0; for (java.awt.DisplayMode mode : displayModes) { boolean duplicate = false; for (int i = 0; i < modes.size(); i++) { if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) { duplicate = true; break; } } if (duplicate) continue; if (mode.getBitDepth() != desktopMode.getBitDepth()) continue; modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode .getBitDepth())); } return modes.toArray(new DisplayMode[modes.size()]); } }
public static DisplayMode getDesktopDisplayMode () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode mode = device.getDisplayMode(); return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); }
final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); final DisplayMode previousDisplayMode = gd.getDisplayMode(); new Object[]{gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight(), gd.getDisplayMode().getBitDepth(), gd.getDisplayMode().getRefreshRate()});
public static DisplayMode getDesktopDisplayMode () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode mode = device.getDisplayMode(); return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); }
if( VRdev.getDisplayMode().equals(useDM) == false ) { VRdev.setDisplayMode(useDM); settings.setFrequency(defDev.getDisplayMode().getRefreshRate()); settings.setDepthBits(24); settings.setVSync(true);
@Override public DefaultRequest discoverParameters(GoogleAnalyticsConfig config, DefaultRequest request) { super.discoverParameters(config, request); Toolkit toolkit = Toolkit.getDefaultToolkit(); if (isEmpty(request.screenResolution())) { Dimension screenSize = toolkit.getScreenSize(); request.screenResolution(((int) screenSize.getWidth()) + "x" + ((int) screenSize.getHeight()) + ", " + toolkit.getScreenResolution() + " dpi"); } if (isEmpty(request.screenColors())) { GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices(); StringBuilder sb = new StringBuilder(); for (GraphicsDevice graphicsDevice : graphicsDevices) { if (sb.length() != 0) { sb.append(", "); } sb.append(graphicsDevice.getDisplayMode().getBitDepth()); } request.screenColors(sb.toString()); } return request; } }
if( VRdev.getDisplayMode().equals(useDM) == false ) { VRdev.setDisplayMode(useDM); if (macOs) { settings.setFrequency(defDev.getDisplayMode().getRefreshRate()); settings.setDepthBits(24); settings.setVSync(true);
public ScreenCaptureDevice(final GraphicsDevice device) { this.device = device; this.mode = device.getDisplayMode(); this.resolution = new Dimension(mode.getWidth(), mode.getHeight()); this.resolutions = new Dimension[] { this.resolution }; try { this.robot = new Robot(device); } catch (AWTException e) { throw new WebcamException("Unable to create robot", e); } LOG.trace("Screen device {} with resolution {} has been created", getName(), getResolution()); }
public FullscreenDisplayHandler() { gfxDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); displayMode = gfxDevice.getDisplayMode(); frame = new GridPanelFrame(displayMode.getWidth(), displayMode.getHeight()); MediaRenderer.APP.log( Level.INFO, "Enabling fullscreen handler (press ESC to exit) with resolution: " + displayMode.getWidth() + "x" + displayMode.getHeight() ); frame.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) MediaRenderer.APP.getMediaRenderer().stopAllMediaPlayers(); } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); }
/** * Get the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available) or the screen size. * @return the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available). * @see #getCanvasSize() */ public Vector2f getCanvasToWindowRatio() { if (environment != null){ if (environment.getApplication() != null){ if( ratio == null ) { ratio = new Vector2f(); Vector2f canvas = getCanvasSize(); int width = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(), environment.getApplication().getContext().getSettings().getWidth()); int height = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(), environment.getApplication().getContext().getSettings().getHeight()); ratio.x = Float.max(1f, canvas.x / width); ratio.y = Float.max(1f, canvas.y / height); } return ratio; } else { throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application."); } } else { throw new IllegalStateException("VR GUI manager is not attached to any environment."); } }
int origWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(); int origHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(); long window = ((LwjglWindow)environment.getApplication().getContext()).getWindowHandle(); Vector2f windowSize = new Vector2f();
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight();
private boolean isBitonal(Graphics2D graphics) { GraphicsConfiguration deviceConfiguration = graphics.getDeviceConfiguration(); if (deviceConfiguration == null) { return false; } GraphicsDevice device = deviceConfiguration.getDevice(); if (device == null) { return false; } DisplayMode displayMode = device.getDisplayMode(); if (displayMode == null) { return false; } return displayMode.getBitDepth() == 1; }
int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight();
int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight();
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(320, 240); this.setLocation((getGraphicsConfiguration().getDevice().getDisplayMode().getWidth() - getWidth()) / 2, (getGraphicsConfiguration().getDevice().getDisplayMode().getHeight() - getHeight()) / 2); this.setContentPane(getJContentPane()); this.setTitle(o.getClass().getSimpleName()); this.setVisible(true); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(640, 480); this.setLocation((getGraphicsConfiguration().getDevice() .getDisplayMode().getWidth() - getWidth()) / 2, (getGraphicsConfiguration().getDevice().getDisplayMode() .getHeight() - getHeight()) / 2); setContentPane(getJContentPane()); setTitle("Spoon"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); }