Examples of GraphicsConfiguration


Examples of java.awt.GraphicsConfiguration

  private void createIcons() {
    Border border = style.getBorderDown();
    Insets insets = border.getBorderInsets(null);
   
    // Image used as the template for the icons
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    BufferedImage image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
   
    // Active, not selected
    Graphics2D g = image.createGraphics();
    g.setColor(style.getForeground());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
    g.setClip(0, 0, ICON_WIDTH, ICON_WIDTH);
    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
    g.dispose();
    defaultIcon = new ImageIcon(image);
   
    // Active, selected
    // Icon does not copy the image, so we need a new one
    BufferedImage image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image2.createGraphics();
    // Copy the old image to the background
    g.drawImage(image, 0, 0, null);
    // Draw the tick
    BasicStroke stroke = new BasicStroke(2);
    g.setStroke(stroke);
    g.setColor(style.getShadowColor());
    drawTick(g, insets);
    g.dispose();
    defaultSelectedIcon = new ImageIcon(image2);
   
    // Inactive, not selected
    image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image2.createGraphics();
    g.setColor(style.getShadowColor());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
    g.setClip(0, 0, ICON_WIDTH, ICON_WIDTH);
    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
    g.dispose();
    disabledIcon = new ImageIcon(image2);
   
    // Inactive, selected
    image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image.createGraphics();
    // Copy unselected image
    g.drawImage(image2, 0, 0, null);
    g.setStroke(stroke);
    g.setColor(style.getHighLightColor());
View Full Code Here

Examples of java.awt.GraphicsConfiguration

   */
  private Image makeModifiedImage(Sprite template, Color color) {
    final int width = template.getWidth();
    final int height = template.getHeight();
   
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    final BufferedImage image = gc.createCompatibleImage(width, height, Transparency.OPAQUE);
   
    Graphics2D g = image.createGraphics();
    template.draw(g, 0, 0);
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
    g.setColor(color);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

            return;
        }
        Dimension size;
        Point screenLocation = component.getLocationOnScreen();
        Point location = new Point();
        GraphicsConfiguration gc;
        gc = component.getGraphicsConfiguration();
        Rectangle sBounds = gc.getBounds();
        Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
        // Take into account screen insets, decrease viewport
        sBounds.x += screenInsets.left;
        sBounds.y += screenInsets.top;
        sBounds.width -= (screenInsets.left + screenInsets.right);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

public class Java2dHelper {

    public static BufferedImage createCompatibleImage(int width, int height) {
        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice screenDevice = environment.getDefaultScreenDevice();
        GraphicsConfiguration configuration = screenDevice.getDefaultConfiguration();
        return configuration.createCompatibleImage(width, height);
    }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

        }
    }

    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

Examples of java.awt.GraphicsConfiguration

    oldDisplayMode = graphicsDevice.getDisplayMode();
    if (!graphicsDevice.isFullScreenSupported()) {
      System.out.println("Full screen mode failed");
      System.exit(1);
    } else {
      GraphicsConfiguration gc = graphicsDevice.getDefaultConfiguration();
      window = new Frame(gc);
    }
  }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

    }

    public GraphicsConfiguration getDeviceConfiguration() {
        Graphics2D g2d = getBogusGraphics2D();

        GraphicsConfiguration gConf = g2d.getDeviceConfiguration();

        g2d.dispose();

        return gConf;
    }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

    }

    public GraphicsConfiguration getDeviceConfiguration() {
        Graphics2D g2d = getBogusGraphics2D(true);

        GraphicsConfiguration gConf = g2d.getDeviceConfiguration();

        g2d.dispose();

        return gConf;
    }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

    if (ge.isHeadlessInstance()) {
      img = new BufferedImage(w, h,
          layerId.equals("backing") ? BufferedImage.TYPE_INT_RGB
              : BufferedImage.TYPE_INT_ARGB);
    } else {
      GraphicsConfiguration gc = ge.getDefaultScreenDevice()
          .getDefaultConfiguration();
//        int imageType = layerId.equals("backing") && false ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
//        img = new BufferedImage((int)b.width, (int)b.height, imageType);
      img = gc.createCompatibleImage(w, h,
          layerId.equals("backing") ? Transparency.OPAQUE
              : Transparency.TRANSLUCENT);
    }
    ctx = (Graphics2D) img.createGraphics();
    ctx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
View Full Code Here

Examples of java.awt.GraphicsConfiguration

            GraphicsDevice[] gs = ge.getScreenDevices();
            if (gs.length > 1) {
                LOGGER.warning("Fullscreen using size of first screen");
            }

            GraphicsConfiguration gc = gs[0].getDefaultConfiguration();
            Rectangle size = gc.getBounds();

            setBounds(size);
        } else {
            // user-specified size. Try to set the size of the 3d canvas to
            // the size the user specified
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.