Package java.awt

Examples of java.awt.GraphicsConfiguration


            px += margin.left;
            pw = Math.max(pw - LEFT_SHIFT - margin.left, listWidth);
        }

        // Calculate the desktop dimensions relative to the combo box.
        GraphicsConfiguration gc = comboBox.getGraphicsConfiguration();
        Point                 p  = new Point();

        SwingUtilities.convertPointFromScreen(p, comboBox);

        if (gc == null) {
            screenBounds = new Rectangle(p, toolkit.getScreenSize());
        } else {

            // Get the screen insets.
            Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);

            screenBounds        =  new Rectangle(gc.getBounds());
            screenBounds.width  -= (screenInsets.left + screenInsets.right);
            screenBounds.height -= (screenInsets.top + screenInsets.bottom);
            screenBounds.x      += screenInsets.left;
            screenBounds.y      += screenInsets.top;
        }
View Full Code Here


    }

    private static Integer defaultContrast;
    static Integer getDefaultLCDContrast() {
  if (defaultContrast == null) {
      GraphicsConfiguration gc =
      GraphicsEnvironment.getLocalGraphicsEnvironment().
    getDefaultScreenDevice().getDefaultConfiguration();
  Graphics2D g2d =
      (Graphics2D)(gc.createCompatibleImage(1,1).getGraphics());
  defaultContrast = (Integer)
      g2d.getRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST);
  }
  return defaultContrast;
    }
View Full Code Here

                    validatedContents = true;
                }
            }

            // now validate the backbuffer
            GraphicsConfiguration gc = getGraphicsConfiguration_NoClientCode();
            int returnCode =
                backBuffers[backBuffers.length - 1].validate(gc);
            if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) {
                if (checkSize) {
                    createBackBuffers(backBuffers.length);
View Full Code Here

            }
        }
    }

    final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
        GraphicsConfiguration graphicsConfig = this.graphicsConfig;
        Container parent = this.parent;
        if (graphicsConfig != null) {
            return graphicsConfig;
        } else if (parent != null) {
            return parent.getGraphicsConfiguration_NoClientCode();
View Full Code Here

            // might have been replaced in response to a display change event
            updateInternalBuffers();

            // now validate the backbuffer
            if (drawVBuffer != null) {
                GraphicsConfiguration gc =
                        getGraphicsConfiguration_NoClientCode();
                int returnCode = drawVBuffer.validate(gc);
                if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) {
                    try {
                        createBuffers(numBuffers, caps);
View Full Code Here

    /*
     * Class under test for void JFrame(String, GraphicsConfiguration)
     */
    public void testJFrameStringGraphicsConfiguration() {
        final String title = "Test frame.";
        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDefaultConfiguration();
        // test with valid title, valid gc
        // would be nice to test non-default gc here
        frame = new JFrame(title, gc);
        assertEquals("Title is set properly", title, frame.getTitle());
View Full Code Here

    /*
     * Class under test for void JFrame(GraphicsConfiguration)
     */
    public void testJFrameGraphicsConfiguration() {
        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDefaultConfiguration();
        // test with valid gc
        // would be nice to test non-default gc here
        frame = new JFrame(gc);
        assertEquals("title is empty", "", frame.getTitle());
View Full Code Here

        return ret;
    }

    private static BufferedImage checkCompatibility( BufferedImage im ) {
        // obtain the current system graphical settings
        GraphicsConfiguration gfx_config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().
                getDefaultConfiguration();

        /*
         * if image is already compatible and optimized for current system
         * settings, simply return it
         */
        if ( im.getColorModel().equals( gfx_config.getColorModel() ) ) {
            return im;
        }

        // image is not optimized, so create a new image that is
        BufferedImage new_image = gfx_config.createCompatibleImage(
                im.getWidth(), im.getHeight(), im.getTransparency() );

        // get the graphics context of the new image to draw the old image on
        Graphics2D g2d = (Graphics2D) new_image.getGraphics();

View Full Code Here

        this.setMinimumSize(new Dimension(22, 22));
        this.setOpaque(false);
    }

    public void setBuffer() {
        GraphicsConfiguration configuration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        vgBuffer = configuration.createCompatibleImage(bw, bh, Transparency.TRANSLUCENT);
    }
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

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.