Package java.awt

Examples of java.awt.DisplayMode


        if (VERBOSE) System.err.println("JoglPipeline.validGraphicsMode()");

        // FIXME: believe this should do exactly what the native code
        // used to, but not 100% sure (also in theory should only run
        // this code on the Windows platform? What about Mac OS X?)
        DisplayMode currentMode =
                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
        // Note: on X11 platforms, a bit depth < 0 simply indicates that
        // multiple visuals are supported on the current display mode

        if (VERBOSE) System.err.println("  Returning " + (currentMode.getBitDepth() < 0 ||
                currentMode.getBitDepth() > 8));

        return (currentMode.getBitDepth() < 0 ||
                currentMode.getBitDepth() > 8);
    }
View Full Code Here


         }
      });

      this.setMinimumSize(new Dimension(750, 550)); // Set minimum to fit on an 800x600 screen.
      // If the screen is small then maximize the frame.
      DisplayMode dm = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
      if (dm.getWidth() <= DEFAULT_SIZE.width || dm.getHeight() <= DEFAULT_SIZE.height + 25)
      {
         this.setExtendedState(JFrame.MAXIMIZED_BOTH);
      }
      else
      {
         this.setSize(DEFAULT_SIZE);
         // Center the frame on the screen.
         this.setLocation(dm.getWidth() / 2 - DEFAULT_SIZE.width / 2, dm.getHeight() /
                                                                      2 -
                                                                      DEFAULT_SIZE.height /
                                                                      2);
      }
View Full Code Here

        }
    }

    private DisplayMode findDisplayMode( DisplayMode[] displayModes, int requestedWidth, int requestedHeight, int requestedDepth, int requestedRefreshRate ) {
        // Try to find an exact match
        DisplayMode displayMode = findDisplayModeInternal( displayModes, requestedWidth, requestedHeight, requestedDepth, requestedRefreshRate );

        // Try again, ignoring the requested bit depth
        if ( displayMode == null )
            displayMode = findDisplayModeInternal( displayModes, requestedWidth, requestedHeight, DONT_CARE, DONT_CARE );
View Full Code Here

        return displayMode;
    }

    private DisplayMode findDisplayModeInternal( DisplayMode[] displayModes, int requestedWidth, int requestedHeight, int requestedDepth, int requestedRefreshRate ) {
        DisplayMode displayModeToUse = null;
        for ( int i = 0; i < displayModes.length; i++ ) {
            DisplayMode displayMode = displayModes[i];
            if ( ( requestedWidth == DONT_CARE || displayMode.getWidth() == requestedWidth ) &&
                    ( requestedHeight == DONT_CARE || displayMode.getHeight() == requestedHeight ) &&
                    ( requestedHeight == DONT_CARE || displayMode.getRefreshRate() == requestedRefreshRate ) &&
                    ( requestedDepth == DONT_CARE || displayMode.getBitDepth() == requestedDepth ) )
                displayModeToUse = displayMode;
        }

        return displayModeToUse;
    }
View Full Code Here

      } );
     
      frame.setBackground(Color.black);
      frame.setUndecorated(true);

      DisplayMode dm = _graphicsDeviceArray[i].getDisplayMode();
      frame.setSize(dm.getWidth(), dm.getHeight());
     
      PhotoCanvas pc = new PhotoCanvas( dm.getWidth(), dm.getHeight() );
     
      _photoCanvasList.add( pc );

      frame.add( pc, SpringLayout.WEST );
      frame.pack();
View Full Code Here

    } );
       
    frame.setBackground(Color.black);
    frame.setUndecorated(true);

    DisplayMode dm = _graphicsDeviceArray[_screenNumber-1].getDisplayMode();
    frame.setSize(dm.getWidth(), dm.getHeight());
   
    PhotoCanvas pc = new PhotoCanvas( dm.getWidth(), dm.getHeight() );
   
    _photoCanvasList.add( pc );

    frame.add( pc, SpringLayout.WEST );
    frame.pack();
View Full Code Here

        // Uncomment to hide the menubar, toolbar, or alter window size...
        // configurer.setShowMenuBar(false);
        // configurer.setShowToolBar(false);
        configurer.setShowStatusBar(true);

        DisplayMode dm = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();

        // start almost maximized - 10%
        final int maxWidth = dm.getWidth();
        final int maxHeight = dm.getHeight();
        configurer.setInitialSize(new Dimension(maxWidth - (maxWidth / 10), maxHeight - (maxHeight / 10)));

        // start centered...
        // Point p = new Point();
        // p.x = (maxWidth / 2) - (getWidth() / 2);
View Full Code Here

    // and checking each one)
    private native boolean isDisplayModeAvailable(int screen, int width, int height,
        int bitDepth, int refreshRate);

    public synchronized DisplayMode getDisplayMode() {
        DisplayMode res = getCurrentDisplayMode(screen);
        return res;
    }
View Full Code Here

        // get all graphic devices attached to computer
        GraphicsDevice[] gs = ge.getScreenDevices();

        // create dump entry for each device 
        for (int i=0; i < gs.length; i++) {
            DisplayMode mode = gs[i].getDisplayMode();
            Rectangle bounds = new Rectangle(0, 0, mode.getWidth(), mode.getHeight());
            BufferedImage screenshot = new Robot(gs[i]).createScreenCapture(bounds);

            // to attach your entry to destination you have to execute this line
            OutputStream outputStream = destination.add("screenshot/display_" + i + ".png");
            ImageIO.write(screenshot, "PNG", outputStream);
View Full Code Here

    };

    public WinGraphicsDevice(int left, int top, int right, int bottom, String id, boolean primary) {
        type = TYPE_RASTER_SCREEN;
        bounds = new Rectangle(left, top, right-left, bottom-top);
        displayMode = new DisplayMode(bounds.width, bounds.height, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN);
        this.id = id;
        this.primary = primary;
    }
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.