Examples of GraphicsDevice


Examples of java.awt.GraphicsDevice

public class Java2dHelper {

    public static BufferedImage createCompatibleImage(int width, int height) {
        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice screenDevice = environment.getDefaultScreenDevice();
        GraphicsConfiguration configuration = screenDevice.getDefaultConfiguration();
        return configuration.createCompatibleImage(width, height);
    }
View Full Code Here

Examples of java.awt.GraphicsDevice

    }

    @Override
    public void enterFullScreenMode() {
        Logger.debug("enterFullScreenMode()");
        GraphicsDevice graphicsDevice = getScreenDevice();
        Logger.debug("graphicsDevice={}", graphicsDevice);
        boolean fullScreenSupported = graphicsDevice.isFullScreenSupported();
        Logger.debug("fullScreenSupported={}", fullScreenSupported);
        onBeforeEnterFullScreenMode();
        graphicsDevice.setFullScreenWindow(window);
        DisplayMode displayMode = getDisplayMode(graphicsDevice.getDisplayModes());
        Logger.debug("displayMode={}", displayMode);
        if(displayMode != null) {
            Logger.debug("Setting new display mode");
            graphicsDevice.setDisplayMode(displayMode);
        }
        else {
            Logger.debug("Using default display mode");
        }
    }
View Full Code Here

Examples of java.awt.GraphicsDevice

        if (o != null)
            return (BufferedImage)(((Reference)o).get());

        // Check if this is a BufferedImage G2d if so throw an error...
        GraphicsConfiguration gc = g2d.getDeviceConfiguration();
        GraphicsDevice gd = gc.getDevice();
        if (WARN_DESTINATION &&
            (gd.getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) &&
            (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) !=
                RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING))
            // throw new IllegalArgumentException
            System.out.println
                ("Graphics2D from BufferedImage lacks BUFFERED_IMAGE hint");
View Full Code Here

Examples of java.awt.GraphicsDevice

  public static void saveScreenShot(final int modifiers)
  {
    final Component component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    final GraphicsConfiguration graphicsConfiguration = component.getGraphicsConfiguration();
    final GraphicsDevice graphicsDevice = graphicsConfiguration.getDevice();
    try
    {
      final Robot robot = new Robot(graphicsDevice);
      final BufferedImage image;
      if ((modifiers & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK)
View Full Code Here

Examples of java.awt.GraphicsDevice

  {
    final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    final GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
    for (int i = 0; i < devices.length; i++)
    {
      final GraphicsDevice device = devices[i];
      final Rectangle rectangle = device.getDefaultConfiguration().getBounds();
      if (rectangle.contains(bounds) || rectangle.equals(bounds))
      {
        logger.info("Found a usable screen-configuration: Restoring frame to " + bounds);
        frame.setBounds(bounds);
        return true;
View Full Code Here

Examples of java.awt.GraphicsDevice

  private void switchResolution() {
LOGGER.debug("switchResolution");
   
    try {
      GraphicsDevice myGraphicsDevice = GraphicsEnvironment
          .getLocalGraphicsEnvironment().getDefaultScreenDevice();
      this.frame.setResizable(false);
      this.frame.setUndecorated(true);

      myGraphicsDevice.setFullScreenWindow(this.frame);
      this.frame.setVisible(true);

      DisplayMode myDisplayMode = new DisplayMode(width, height, 32,
          DisplayMode.REFRESH_RATE_UNKNOWN);

      myGraphicsDevice.setDisplayMode(myDisplayMode);

    } catch (Exception e) {
    }

  }
View Full Code Here

Examples of java.awt.GraphicsDevice

        /** Return the default graphics configuration. */
        public GraphicsConfiguration getAlphaCompatibleGraphicsConfiguration() {
            GraphicsEnvironment env = GraphicsEnvironment
                                                         .getLocalGraphicsEnvironment();
            GraphicsDevice dev = env.getDefaultScreenDevice();
            return dev.getDefaultConfiguration();
        }
View Full Code Here

Examples of java.awt.GraphicsDevice

    public static void setFullScreen(boolean fullScreen) {
        setFullScreen(fullScreen, true);
    }

    private static void setFullScreen(boolean fullScreen, boolean visible) {
        GraphicsDevice graphicsDevice = windowedHostFrame.getGraphicsConfiguration().getDevice();

        if (fullScreen) {
            // Go to full screen mode
            if (windowedHostFrame.isVisible()) {
                windowedHostFrame.remove(primaryDisplayHost);
            }

            windowedHostFrame.setVisible(false);

            // Setting the full screen window now will cause a SplashScreen to
            // be dismissed, so don't do so if the --preserveSplashScreen
            // startup property was true, and a SplashScreen was supplied.
            // When the SplashScreen needs to be dismissed, users can call
            // replaceSplashScreen(Display) which will set the full screen
            // window, if required.
            if (visible) {
                graphicsDevice.setFullScreenWindow(fullScreenHostFrame);
            }

            fullScreenHostFrame.add(primaryDisplayHost);
            fullScreenHostFrame.setTitle(windowedHostFrame.getTitle());
            fullScreenHostFrame.setVisible(visible);
        } else {
            // Go to windowed mode
            if (fullScreenHostFrame.isVisible()) {
                fullScreenHostFrame.remove(primaryDisplayHost);
            }

            fullScreenHostFrame.setVisible(false);

            graphicsDevice.setFullScreenWindow(null);

            windowedHostFrame.add(primaryDisplayHost);
            windowedHostFrame.setTitle(fullScreenHostFrame.getTitle());
            windowedHostFrame.setVisible(visible);
        }
View Full Code Here

Examples of java.awt.GraphicsDevice

     * @param display Display to make visible
     * @see java.awt.SplashScreen
     */
    public static void replaceSplashScreen(Display display) {
        java.awt.Window hostWindow = display.getHostWindow();
        GraphicsDevice device = windowedHostFrame.getGraphicsConfiguration().getDevice();
        if ((hostWindow == fullScreenHostFrame) && (device.getFullScreenWindow() == null)) {
            device.setFullScreenWindow(fullScreenHostFrame);
        }
        hostWindow.setVisible(true);
    }
View Full Code Here

Examples of java.awt.GraphicsDevice

public class security implements Testlet
{
  public void test(TestHarness harness)
  {
    try {
      GraphicsDevice gd =
  GraphicsEnvironment.getLocalGraphicsEnvironment()
                     .getDefaultScreenDevice();

      Permission[] createRobot = new Permission[] {
  new AWTPermission("createRobot")};
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.