Package java.awt

Examples of java.awt.GraphicsConfiguration


    lastRefresh = thistime;

    Graphics2D g3 = (Graphics2D) g;
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
    .getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    if (bufferedImage == null)
    bufferedImage = gc.createCompatibleImage(resolution.x,
    resolution.y, Transparency.OPAQUE);

    Graphics2D g2 = bufferedImage.createGraphics();
    g2.setColor(new Color(30, 40, 50));
    Rectangle new_rect = new Rectangle(0, 0, resolution.x, resolution.y);
View Full Code Here


    c.setTile(tile);

    // GENERATE MERGED TILE IMAGE
    // FIXME: although faster, the following doesn't seem to handle alpha on
    // some platforms...
    GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Image tileImg = config.createCompatibleImage(c.getWidth(), c.getHeight());
    c.render(tileImg.getGraphics());
    tile.setImage(tileImg);

    myTs.addTile(tile);
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

    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

    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

      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

    // Get available screens
    // O(n^3), this is nasty, but since we aren't dealling with
    // many items it should be fine
    for (int i=0; i < gd.length; i++)
    {
      GraphicsConfiguration gc = gd[i]
        .getDefaultConfiguration();
      // Don't add duplicates
      if (window.intersects(gc.getBounds()))
      {
        for (Enumeration e = intersects.elements(); e.hasMoreElements();)
        {
          GraphicsConfiguration gcc = (GraphicsConfiguration)e.nextElement();
          if (gcc.getBounds().equals(gc.getBounds()))
            break;
        }
        intersects.add(gc);
      }
    }
   
    GraphicsConfiguration choice = null;
    if (intersects.size() > 0)
    {
      // Pick screen with largest intersection
      for (Enumeration e = intersects.elements(); e.hasMoreElements();)
      {
        GraphicsConfiguration gcc = (GraphicsConfiguration)e.nextElement();
        if (choice == null)
          choice = gcc;
        else
        {
          Rectangle int1 = choice.getBounds().intersection(window);
          Rectangle int2 = gcc.getBounds().intersection(window);
          int area1 = int1.width * int1.height;
          int area2 = int2.width * int2.height;
          if (area2 > area1)
            choice = gcc;
        }
View Full Code Here

   
    }

  private BufferedImage loadMapImage() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
    File file = new File("bin/map.jpg");
    // String l_filename = IMAGE_DIR + File.separator + filename;
    log.debug("Loading image <"+file.getAbsolutePath()+">");
    try {
      BufferedImage bi = ImageIO.read(file);
      int transparency = bi.getColorModel().getTransparency();
      BufferedImage copy = gc.createCompatibleImage(bi.getWidth(), bi.getHeight(), transparency);
      Graphics2D g2d = copy.createGraphics();
      g2d.drawImage(bi,0,0,null);
      g2d.dispose();
      return copy;
    }
View Full Code Here

     * frame and use that.
     */
    protected void _createViewScreen() {
        super._createViewScreen();

        GraphicsConfiguration config = SimpleUniverse
                .getPreferredConfiguration();

        _offScreenCanvas = new Canvas3D(config, true);
        _offScreenCanvas.getScreen3D().setSize(_canvas.getScreen3D().getSize());
        _offScreenCanvas.getScreen3D().setPhysicalScreenWidth(
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.