Package java.awt

Examples of java.awt.DisplayMode


    /**
     * Finds a display mode that is different from the current display
     * mode and is likely to cause a display change event.
     */
    private static DisplayMode findDisplayMode(GraphicsDevice gd) {
        DisplayMode dms[] = gd.getDisplayModes();
        DisplayMode currentDM = gd.getDisplayMode();
        for (DisplayMode dm : dms) {
            if (!dm.equals(currentDM) &&
                 dm.getRefreshRate() == currentDM.getRefreshRate())
            {
                // different from the current dm and refresh rate is the same
                // means that something else is different => more likely to
                // cause a DM change event
                return dm;
View Full Code Here


    }

    private DisplayMode getDefaultDisplayMode() {
        GraphicsConfiguration gc = getDefaultConfiguration();
        Rectangle r = gc.getBounds();
        return new DisplayMode(r.width, r.height,
                               DisplayMode.BIT_DEPTH_MULTI,
                               DisplayMode.REFRESH_RATE_UNKNOWN);
    }
View Full Code Here

    int screenHeight = 0;
    int screenWidth = 0;
    // Get size of each screen
    for (int i=0; i<gs.length; i++) {
        DisplayMode dm = gs[i].getDisplayMode();
        screenWidth += dm.getWidth();
        screenHeight += dm.getHeight();
    }
    if(screenHeight != 0 && screenWidth != 0){
      screenResolution = screenWidth+"x"+screenHeight;
    }
   
View Full Code Here

            ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            gs = ge.getScreenDevices();
   
            // Get size of each screen
            for (int i = 0; i < gs.length; i++) {
                DisplayMode dm = gs[i].getDisplayMode();
                screenWidth += dm.getWidth();
                screenHeight += dm.getHeight();
            }
            if (screenHeight != 0 && screenWidth != 0) {
                screenResolution = screenWidth + "x" + screenHeight;
            }
   
View Full Code Here

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    if (FULLSCREEN) {
      GraphicsEnvironment environment = GraphicsEnvironment
          .getLocalGraphicsEnvironment();
      GraphicsDevice myDevice = environment.getDefaultScreenDevice();
      DisplayMode oldDisplayMode = myDevice.getDisplayMode();
      setBounds(getGraphicsConfiguration().getBounds());
      getGraphicsConfiguration().getDevice().setFullScreenWindow(
          Skeleton.that);
      getGraphicsConfiguration().getDevice().setDisplayMode(
          new DisplayMode((int) Math.round(WIDTH * SCALE), (int) Math
              .round(HEIGHT * SCALE), oldDisplayMode
              .getBitDepth(), oldDisplayMode.getRefreshRate()));
    }
    Board game = new Board();
    game.setPreferredSize(new Dimension((int) Math.round(WIDTH * SCALE),
        (int) Math.round(HEIGHT * SCALE)));
    getContentPane().add(game);
 
View Full Code Here

//           setUndecorated(true);
          GraphicsEnvironment environment = GraphicsEnvironment
              .getLocalGraphicsEnvironment();
          GraphicsDevice myDevice = environment
              .getDefaultScreenDevice();
          DisplayMode oldDisplayMode = myDevice.getDisplayMode();
          setBounds(getGraphicsConfiguration().getBounds());
          getGraphicsConfiguration().getDevice().setFullScreenWindow(
              Skeleton.that);
          getGraphicsConfiguration().getDevice().setDisplayMode(
              new DisplayMode((int) Math.round(WIDTH * SCALE),
                  (int) Math.round(HEIGHT * SCALE),
                  oldDisplayMode.getBitDepth(),
                  oldDisplayMode.getRefreshRate()));
//          setVisible(false);
        } else {
          GraphicsDevice device = GraphicsEnvironment
              .getLocalGraphicsEnvironment()
              .getDefaultScreenDevice();
View Full Code Here

   */
  @Nullable
  public static Dimension getScreenSize() throws HeadlessException {
    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screenDevices = graphicsEnvironment.getScreenDevices();
    DisplayMode displayMode = screenDevices[0].getDisplayMode();

    return new Dimension( displayMode.getWidth(), displayMode.getHeight() );
  }
View Full Code Here


  private void showCurrentMode()
  // print the display mode details for the graphics device
  {
    DisplayMode dm = gd.getDisplayMode();
    System.out.println("Current Display Mode: (" + dm.getWidth() + ","
        + dm.getHeight() + "," + dm.getBitDepth() + ","
        + dm.getRefreshRate() + ")  ");
  }
View Full Code Here

        if (graphicsConfig == null) {
          screenWidth = 640;
          screenHeight = 480;
        } else {
          GraphicsDevice gs = graphicsConfig.getDevice();
          DisplayMode dm = gs.getDisplayMode();
          screenWidth = dm.getWidth();
          screenHeight = dm.getHeight();
        }

        // If we found dynamic sizes, return the maximum size possible, and we're done.
        if (hasDynamicWidth && hasDynamicHeight) {
          return new Dimension(screenWidth, screenHeight);
View Full Code Here

        menuBar.setVisible(true);
        this.setJMenuBar(menuBar);
    }

    protected void chooseBestDisplayMode(GraphicsDevice device) {
        DisplayMode best = getBestDisplayMode(device);
        if (best != null) {
            device.setDisplayMode(best);
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.DisplayMode

Copyright © 2018 www.massapicom. 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.