Package java.awt

Examples of java.awt.DisplayMode


    protected abstract ElasticWorld createWorld();

    protected DisplayMode getBestDisplayMode(GraphicsDevice device) {
        Iterator<DisplayMode> itr = getPreferredDisplayModes(device).iterator();
        while (itr.hasNext()) {
            DisplayMode each = itr.next();
            DisplayMode[] modes = device.getDisplayModes();
            for (DisplayMode element : modes) {
                if (element.getWidth() == each.getWidth()
                        && element.getHeight() == each.getHeight()
                        && element.getBitDepth() == each.getBitDepth()) {
                    return each;
                }
            }
        }
View Full Code Here


        }
    }

    public PongGame() {
        screen = new ScreenManager();
        DisplayMode displayMode = screen.findFirstCompatibleMode(POSSIBLE_MODES);
        screen.setFullScreen(displayMode);

        Window window = screen.getFullScreenWindow();
        window.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
        window.setBackground(Color.black);
View Full Code Here

      this.window.setVisible(true);
    }
  }
 
  private void setDisplayMode(int width, int height){
    DisplayMode mode = new DisplayMode(width, height, 32, 60);
    if(this.gd.isDisplayChangeSupported()){
      for(DisplayMode supported : this.gd.getDisplayModes()){
        if(supported.equals(mode)){
          this.gd.setDisplayMode(mode);
          return;
View Full Code Here

        if (!isHeadless) {
            try {
                GraphicsEnvironment env =
                    GraphicsEnvironment.getLocalGraphicsEnvironment();
                GraphicsDevice gd = env.getDefaultScreenDevice();
                DisplayMode mode = gd.getDisplayMode();
                bitDepth = mode.getBitDepth();
                refreshRate = mode.getRefreshRate() / 1024;
                isFullScreen = (gd.getFullScreenWindow() != null);
                displayWidth = mode.getWidth();
                displayHeight = mode.getHeight();

            } catch (Throwable t) {
                isHeadless = true;
            }
        }
View Full Code Here

      this.frame.dispose();
      throw new RuntimeException("Changing Display Mode is not supported");
    }
   
    // find the best display mode
    DisplayMode bestDisplay = this.getBestDisplay(this.size);
    if (bestDisplay == null) {
      JOGLFullScreenMode.DEVICE.setFullScreenWindow(null);
      this.frame.dispose();
      throw new RuntimeException("Changing Display Mode to "
              + this.size.width + "x" + this.size.height
View Full Code Here

  /** ********************* FIND THE BEST DISPLAY MODE ************************ */
  /** ************************************************************************* */
 
  private DisplayMode getBestDisplay(Dimension size) {
    // get display mode for width x height x 32 with the optimum HZ
    DisplayMode mode[] = JOGLFullScreenMode.DEVICE.getDisplayModes();
   
    ArrayList modeList = new ArrayList();
    for (int i = 0; i < mode.length; i++) {
      if (mode[i].getWidth() == size.width
              && mode[i].getHeight() == size.height) {
View Full Code Here

   
    try {
      // centering mouse position
      GraphicsDevice device = GraphicsEnvironment
              .getLocalGraphicsEnvironment().getDefaultScreenDevice();
      DisplayMode mode = device.getDisplayMode();
     
      this.mouseX = this.lastMouseX = (mode.getWidth() / 2) - 10; // 10 ->
      // cursor
      // size
      this.mouseY = this.lastMouseY = (mode.getHeight() / 2) - 10;
      (new Robot()).mouseMove(this.mouseX, this.mouseY);
    }
    catch (Throwable e) {
      // error centering mouse position in initialization, just ignore it
    }
View Full Code Here

      FullScreenMode.DEVICE.setFullScreenWindow(null);
      this.frame.dispose();
      throw new RuntimeException("Changing Display Mode is not supported");
    }
   
    DisplayMode bestDisplay = this.getBestDisplay(this.size);
    if (bestDisplay == null) {
      FullScreenMode.DEVICE.setFullScreenWindow(null);
      this.frame.dispose();
      throw new RuntimeException("Changing Display Mode to "
              + this.size.width + "x" + this.size.height
View Full Code Here

  /** ********************* FIND THE BEST DISPLAY MODE ************************ */
  /** ************************************************************************* */
 
  private DisplayMode getBestDisplay(Dimension size) {
    // get display mode for width x height x 32 with the optimum HZ
    DisplayMode mode[] = FullScreenMode.DEVICE.getDisplayModes();
   
    ArrayList modeList = new ArrayList();
    for (int i = 0; i < mode.length; i++) {
      if (mode[i].getWidth() == size.width
              && mode[i].getHeight() == size.height) {
View Full Code Here

   * In this comparator, the first stack (the one that this graphics engine
   * will be used) will be display mode that has the biggest bits per pixel
   * (bpp) and has the biggest but limited to 75Hz frequency (refresh rate).
   */
  public int compare(Object o1, Object o2) {
    DisplayMode mode1 = (DisplayMode) o1;
    DisplayMode mode2 = (DisplayMode) o2;
   
    int removed1 = (mode1.getRefreshRate() > 75) ? 5000 * mode1
            .getRefreshRate() : 0;
    int removed2 = (mode2.getRefreshRate() > 75) ? 5000 * mode2
            .getRefreshRate() : 0;
   
    return ((mode2.getBitDepth() - mode1.getBitDepth()) * 1000)
            + (mode2.getRefreshRate() - mode1.getRefreshRate())
            - (removed2 - removed1);
  }
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.