Package java.awt

Examples of java.awt.DisplayMode


        GraphicsDevice[] devices = env.getScreenDevices();
        DisplayMode[] modes = devices[0].getDisplayModes();

        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            jComboBoxScreenModes.addItem(m);
        }
    }
View Full Code Here


        GraphicsDevice[] devices = env.getScreenDevices();
        DisplayMode[] modes = devices[0].getDisplayModes();

        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if (s.equals(m)) return displayMode;
        }

        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 32))
            {
                return displayMode;
            }
        }
        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 16))
            {
                return displayMode;
            }
        }
        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 8))
            {
                return displayMode;
            }
        }
        return null;
View Full Code Here

  }
  if (dead) {
      return;
  }
  defaultScreen= screen;
  DisplayMode dm= screen.getDisplayMode();
  GraphicsConfiguration gc= screen.getDefaultConfiguration();
  jf= new JFrame(gc);
  jf.setUndecorated(true);
  jf.setBounds(gc.getBounds());
  jf.getContentPane().add(part);
View Full Code Here

  private Environment() {

    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice dev = env.getDefaultScreenDevice();
    DisplayMode displayMode = dev.getDisplayMode();

    this.screenSize = new Dimension(displayMode.getWidth(), displayMode.getHeight());
  }
View Full Code Here

        }


        assert antframe != null : "Please set AntFrame implementation -antframe package.antframeimplementation !";
        final JFCFrame frame = new JFCFrame(antframe, args);
        DisplayMode dm = JXAenvUtils._defaultGC.getDevice().getDisplayMode();
        frame.setLocation((int) Math.round((double) (dm.getWidth() - size.width) / 2.), (int) Math.round((double) (dm.getHeight() - size.height) / 2.));
        frame.setPreferredSize(size);
        frame.setSize(size);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.initComponents();
        frame.pack();
View Full Code Here

        dm = null;
        dmGL = mode;
    }

    public DisplayMode getDM() {
        return dm != null ? dm : new DisplayMode(getWidth(), getHeight(), getBitDepth(), getRefreshRate());
    }
View Full Code Here

        height = in.readInt();
        bitDepth = in.readInt();
        refreshRate = in.readInt();
        switch (in.readInt()) {
            case 1:
                dm = new DisplayMode(width, height, bitDepth, refreshRate);
                break;
            case 2:
                dmGL = new org.lwjgl.opengl.DisplayMode(width, height);
                break;
            default:
View Full Code Here

        this.add(_glCanvas);

        final boolean isDisplayModeModified;
        final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        // Get the current display mode
        final DisplayMode previousDisplayMode = gd.getDisplayMode();
        // Handle full screen mode if requested.
        if (_settings.isFullScreen()) {
            setUndecorated(true);
            // Check if the full-screen mode is supported by the OS
            boolean isFullScreenSupported = gd.isFullScreenSupported();
            if (isFullScreenSupported) {
                gd.setFullScreenWindow(this);
                // Check if display mode changes are supported by the OS
                if (gd.isDisplayChangeSupported()) {
                    // Get all available display modes
                    final DisplayMode[] displayModes = gd.getDisplayModes();
                    DisplayMode multiBitsDepthSupportedDisplayMode = null;
                    DisplayMode refreshRateUnknownDisplayMode = null;
                    DisplayMode multiBitsDepthSupportedAndRefreshRateUnknownDisplayMode = null;
                    DisplayMode matchingDisplayMode = null;
                    DisplayMode currentDisplayMode;
                    // Look for the display mode that matches with our parameters
                    // Look for some display modes that are close to these parameters
                    // and that could be used as substitutes
                    // On some machines, the refresh rate is unknown and/or multi bit
                    // depths are supported. If you try to force a particular refresh
                    // rate or a bit depth, you might find no available display mode
                    // that matches exactly with your parameters
                    for (int i = 0; i < displayModes.length && matchingDisplayMode == null; i++) {
                        currentDisplayMode = displayModes[i];
                        if (currentDisplayMode.getWidth() == _settings.getWidth()
                                && currentDisplayMode.getHeight() == _settings.getHeight()) {
                            if (currentDisplayMode.getBitDepth() == _settings.getColorDepth()) {
                                if (currentDisplayMode.getRefreshRate() == _settings.getFrequency()) {
                                    matchingDisplayMode = currentDisplayMode;
                                } else if (currentDisplayMode.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN) {
                                    refreshRateUnknownDisplayMode = currentDisplayMode;
                                }
                            } else if (currentDisplayMode.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) {
                                if (currentDisplayMode.getRefreshRate() == _settings.getFrequency()) {
                                    multiBitsDepthSupportedDisplayMode = currentDisplayMode;
                                } else if (currentDisplayMode.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN) {
                                    multiBitsDepthSupportedAndRefreshRateUnknownDisplayMode = currentDisplayMode;
                                }
                            }
                        }
                    }
                    DisplayMode nextDisplayMode = null;
                    if (matchingDisplayMode != null) {
                        nextDisplayMode = matchingDisplayMode;
                    } else if (multiBitsDepthSupportedDisplayMode != null) {
                        nextDisplayMode = multiBitsDepthSupportedDisplayMode;
                    } else if (refreshRateUnknownDisplayMode != null) {
View Full Code Here

        //save off the old display mode.
        dispModeOld = device.getDisplayMode();
        String dispString = Configuration.getConfiguration().getFullScrrenResString();
        if (dispString.trim().length() != 0)
        {
            DisplayMode d = ConfigurationPanel.getDisplayModeForString(dispString);
            if (d!=null) dispMode = d;
        }

        //hide everything
        getFrame().setVisible(false);
View Full Code Here

    this.caps = caps;
    this.chosenIndex = chosenIndex;
    this.device = device;
    //FIXME unit id?
    this.awtGraphicsDevice = new AWTGraphicsDevice(this.device, 0);
    DisplayMode m = device.getDisplayMode();
    width = m.getWidth();
    height = m.getHeight();
  }
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.