Package java.awt

Examples of java.awt.GraphicsConfiguration


    Point p = component.getLocation();

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Rectangle screenBounds;
    Insets screenInsets;
    GraphicsConfiguration gc = null;
    // Try to find GraphicsConfiguration, that includes the component top left corner.
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gd = ge.getScreenDevices();
    for(int i = 0; i < gd.length; i++) {
      if(gd[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
        GraphicsConfiguration dgc = gd[i].getDefaultConfiguration();
        if(dgc.getBounds().contains(p)) {
          gc = dgc;
          break;
        }
      }
    }
View Full Code Here


    Point p = component.getLocation();

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Rectangle screenBounds;
    Insets screenInsets;
    GraphicsConfiguration gc = null;
    // Try to find GraphicsConfiguration, that includes the component top left corner.
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gd = ge.getScreenDevices();
    for(int i = 0; i < gd.length; i++) {
      if(gd[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
        GraphicsConfiguration dgc = gd[i].getDefaultConfiguration();
        if(dgc.getBounds().contains(p)) {
          gc = dgc;
          break;
        }
      }
    }
View Full Code Here

      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();
      int deviceToUse = Integer.valueOf(getProperty(G_PROPERTIES.GRAPHICS_MONITOR));
      if (deviceToUse >= gs.length) deviceToUse =statechum.GlobalConfiguration.DEFAULT_SCREEN;// use the first one if cannot use the requested one.
      GraphicsConfiguration gc = gs[deviceToUse].getDefaultConfiguration();
     
      // from http://java.sun.com/j2se/1.4.2/docs/api/index.html
      Rectangle shape = gc.getBounds();
      Rectangle rect = new Rectangle(new Rectangle(shape.x, shape.y,400,300));
      if (rect.height > shape.height) rect.height=shape.height;if (rect.width > shape.width) rect.width=shape.width;
      rect.y+=windowID*(rect.getHeight()+30);
      int yLimit = shape.height-rect.height;if (rect.y>yLimit) rect.y=yLimit;
      int xLimit = shape.width -rect.width ;if (rect.x>xLimit) rect.x=xLimit;
View Full Code Here

      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();
      int deviceToUse = Integer.valueOf(getProperty(G_PROPERTIES.GRAPHICS_MONITOR));
      if (deviceToUse >= gs.length) deviceToUse =statechum.GlobalConfiguration.DEFAULT_SCREEN;// use the first one if cannot use the requested one.
      GraphicsConfiguration gc = gs[deviceToUse].getDefaultConfiguration();
     
      // from http://java.sun.com/j2se/1.4.2/docs/api/index.html
      Rectangle shape = gc.getBounds();
      Rectangle rect = new Rectangle(new Rectangle(shape.x, shape.y,400,300));
      if (rect.height > shape.height) rect.height=shape.height;if (rect.width > shape.width) rect.width=shape.width;
      rect.y+=windowID*(rect.getHeight()+30);
      int yLimit = shape.height-rect.height;if (rect.y>yLimit) rect.y=yLimit;
      int xLimit = shape.width -rect.width ;if (rect.x>xLimit) rect.x=xLimit;
View Full Code Here

      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();
      int deviceToUse = Integer.valueOf(getProperty(G_PROPERTIES.GRAPHICS_MONITOR));
      if (deviceToUse >= gs.length) deviceToUse =statechum.GlobalConfiguration.DEFAULT_SCREEN;// use the first one if cannot use the requested one.
      GraphicsConfiguration gc = gs[deviceToUse].getDefaultConfiguration();
     
      // from http://java.sun.com/j2se/1.4.2/docs/api/index.html
      Rectangle shape = gc.getBounds();
      Rectangle rect = new Rectangle(new Rectangle(shape.x, shape.y,400,300));
      if (rect.height > shape.height) rect.height=shape.height;if (rect.width > shape.width) rect.width=shape.width;
      rect.y+=windowID*(rect.getHeight()+30);
      int yLimit = shape.height-rect.height;if (rect.y>yLimit) rect.y=yLimit;
      int xLimit = shape.width -rect.width ;if (rect.x>xLimit) rect.x=xLimit;
View Full Code Here

      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();
      int deviceToUse = Integer.valueOf(getProperty(G_PROPERTIES.GRAPHICS_MONITOR));
      if (deviceToUse >= gs.length) deviceToUse =statechum.GlobalConfiguration.DEFAULT_SCREEN;// use the first one if cannot use the requested one.
      GraphicsConfiguration gc = gs[deviceToUse].getDefaultConfiguration();
     
      // from http://java.sun.com/j2se/1.4.2/docs/api/index.html
      Rectangle shape = gc.getBounds();
      Rectangle rect = new Rectangle(new Rectangle(shape.x, shape.y,400,300));
      if (rect.height > shape.height) rect.height=shape.height;if (rect.width > shape.width) rect.width=shape.width;
      rect.y+=windowID*(rect.getHeight()+30);
      int yLimit = shape.height-rect.height;if (rect.y>yLimit) rect.y=yLimit;
      int xLimit = shape.width -rect.width ;if (rect.x>xLimit) rect.x=xLimit;
View Full Code Here

      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();
      int deviceToUse = Integer.valueOf(getProperty(G_PROPERTIES.GRAPHICS_MONITOR));
      if (deviceToUse >= gs.length) deviceToUse =statechum.GlobalConfiguration.DEFAULT_SCREEN;// use the first one if cannot use the requested one.
      GraphicsConfiguration gc = gs[deviceToUse].getDefaultConfiguration();
     
      // from http://java.sun.com/j2se/1.4.2/docs/api/index.html
      Rectangle shape = gc.getBounds();
      Rectangle rect = new Rectangle(new Rectangle(shape.x, shape.y,400,300));
      if (name == G_PROPERTIES.LOWER)
        rect.y+=rect.getHeight()+30;
      result = new WindowPosition(rect,deviceToUse);
      windowCoords.put(name.name(),result);
View Full Code Here

    public static BufferedImage getBufferedImage(Image image, int transparency)
    {
        if (image instanceof BufferedImage)
        return (BufferedImage) image;

        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        // BufferedImage bufferedImage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
        BufferedImage bufferedImage = gc.createCompatibleImage(100, 80, transparency);


        Graphics g = bufferedImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();
View Full Code Here

     * Locates the given component on the screen's center.
     *
     * @param component   the component to be centered
     */
    public static void locateOnOpticalScreenCenter(Component component) {
      GraphicsConfiguration gc = component.getGraphicsConfiguration();
      Rectangle bounds = gc.getBounds();
      int x = (int) ( bounds.getWidth() - component.getWidth() ) /2 ;
      int y = (int) ( bounds.getHeight() - component.getHeight() ) /2;
      component.setLocation( x, y );
    }
View Full Code Here

        }
    }

    private synchronized void paintBuffered(Graphics g) {
        do {
            GraphicsConfiguration config = getGraphicsConfiguration();
            int width = getWidth();
            int height = getHeight();
            if (backBuffer == null || width != backBuffer.getWidth() || height != backBuffer.getHeight() || backBuffer.validate(config) == VolatileImage.IMAGE_INCOMPATIBLE) {
                if (backBuffer != null) {
                    backBufferGraphics.dispose();
                    backBufferGraphics = null;
                    backBuffer.flush();
                    backBuffer = null;
                }
                backBuffer = config.createCompatibleVolatileImage(width, height);
                backBufferGraphics = backBuffer.createGraphics();
            }
            backBufferGraphics.setClip(g.getClip());
            paintUnbuffered(backBufferGraphics);
            g.drawImage(backBuffer, 0, 0, this);
View Full Code Here

TOP

Related Classes of java.awt.GraphicsConfiguration

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.