Package java.awt

Examples of java.awt.GraphicsDevice


    {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(AA_KEY, AA_VALUE);
        GraphicsEnvironment env = GraphicsEnvironment.
                getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        bi = gc.createCompatibleImage(getWidth(), H, TYPE);
        paintOnImage(g2d);
        g2d.drawImage(bi, 0, 0, null);
        super.paintComponent(g2d);
    }
View Full Code Here


        Graphics2D g2d = (Graphics2D) g;
        if (!isCached())
        {
            GraphicsEnvironment env = GraphicsEnvironment.
                    getLocalGraphicsEnvironment();
            GraphicsDevice gd = env.getDefaultScreenDevice();
            GraphicsConfiguration gc = gd.getDefaultConfiguration();
            bi = gc.createCompatibleImage(getWidth(), getHeight(), TRANSPARENCY);
            drawOnImage((Graphics2D) bi.getGraphics());
        }
        g2d.setRenderingHint(AA_KEY, AA_VALUE);
        g2d.drawImage(bi, 0, 0, null);
View Full Code Here

    /** Caches the rectangle and buffered image */
    private void createGraphics()
    {
        GraphicsEnvironment env = GraphicsEnvironment.
                getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        bi = gc.createCompatibleImage(getWidth(), H, TYPE);
        rect = new Rectangle(0, 0, getWidth(), H);
    }
View Full Code Here

     * display settings are changed.
     */
    @Override
    public void displayChanged() {
        // getNumScreens() will return the correct current number of screens
        GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
        GraphicsDevice oldScreens[] = screens;
        // go through the list of current devices and determine if they
        // could be reused, or will have to be replaced
        if (oldScreens != null) {
            for (int i = 0; i < oldScreens.length; i++) {
                if (!(screens[i] instanceof Win32GraphicsDevice)) {
View Full Code Here

      mode.getBitDepth());
  }

  public static DisplayMode[] getDisplayModes () {
    GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice device = genv.getDefaultScreenDevice();
    java.awt.DisplayMode desktopMode = device.getDisplayMode();
    java.awt.DisplayMode[] displayModes = device.getDisplayModes();
    ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>();
    int idx = 0;
    for (java.awt.DisplayMode mode : displayModes) {
      boolean duplicate = false;
      for (int i = 0; i < modes.size(); i++) {
View Full Code Here

    }
  }

  public static DisplayMode getDesktopDisplayMode () {
    GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice device = genv.getDefaultScreenDevice();
    java.awt.DisplayMode mode = device.getDisplayMode();
    return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(),
      mode.getBitDepth());
  }
View Full Code Here

  public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    System.out.println("number of devices = " + gs.length);
    for (int j = 0; j < gs.length; j++) {
      GraphicsDevice gd = gs[j];
      GraphicsConfiguration[] gc = gd.getConfigurations();
      for (int i = 0; i < gc.length; i++) {
        JFrame f = new JFrame(gs[j].getDefaultConfiguration());
        f.setTitle(gs[j].getIDstring());
        JButton jb = new JButton("This is an example button");
        Rectangle gcBounds = gc[i].getBounds();
View Full Code Here

   
    return bestConfig;
  }
 
  private void makeFullScreen(StreamConfiguration streamConfig) {
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    if (gd.isFullScreenSupported()) {
      this.setResizable(false);
      this.setUndecorated(true);
      gd.setFullScreenWindow(this);

      if (gd.isDisplayChangeSupported()) {
        DisplayMode config = getBestDisplay(streamConfig, gd.getDisplayModes());
        if (config != null) {
          gd.setDisplayMode(config);
        }
      } else {
        JOptionPane.showMessageDialog(
            this,
            "Unable to change display resolution. \nThis may not be the correct resolution",
View Full Code Here

          if (hasAlpha) {
              transparency = Transparency.BITMASK;
          }

          // Create the buffered image
          GraphicsDevice gs = ge.getDefaultScreenDevice();
          GraphicsConfiguration gc = gs.getDefaultConfiguration();
          bimage = gc.createCompatibleImage(
              image.getWidth(null), image.getHeight(null), transparency);
      } catch (HeadlessException e) {
          // The system does not have a screen
      }
View Full Code Here

*/
public class BufferStrategyExceptionTest {
    private static final int TEST_REPS = 20;

    public static void main(String[] args) {
        GraphicsDevice gd =
            GraphicsEnvironment.getLocalGraphicsEnvironment().
                getDefaultScreenDevice();

        for (int i = 0; i < TEST_REPS; i++) {
            TestFrame f = new TestFrame();
            f.pack();
            f.setSize(400, 400);
            f.setVisible(true);
            if (i % 2 == 0) {
                gd.setFullScreenWindow(f);
            }
            // generate a resize event which will invalidate the peer's
            // surface data and hopefully cause an exception during
            // BufferStrategy creation in TestFrame.render()
            Dimension d = f.getSize();
            d.width -= 5; d.height -= 5;
            f.setSize(d);

            f.render();
            gd.setFullScreenWindow(null);
            sleep(100);
            f.dispose();
        }
        System.out.println("Test passed.");
    }
View Full Code Here

TOP

Related Classes of java.awt.GraphicsDevice

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.