Examples of GraphicsConfiguration


Examples of java.awt.GraphicsConfiguration

            /*
             * throw new Exception();
             */

            // #else
            GraphicsConfiguration config = o.getGraphicsConfiguration();
            GraphicsDevice dev = config.getDevice();
            d = config.getBounds();

            // #endif JAVA1
        } catch (Throwable t) {
        }
        positionComponent(p, c, d);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

      /*
       * throw new Exception();
       */

      // #else
      GraphicsConfiguration config = o.getGraphicsConfiguration();
      GraphicsDevice dev = config.getDevice();
      d = config.getBounds();

      // #endif JAVA1
    } catch (Throwable t) {
    }
    positionComponent(p, c, d);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

            /*
             * throw new Exception();
             */

            // #else
            GraphicsConfiguration config = o.getGraphicsConfiguration();
            GraphicsDevice dev = config.getDevice();
            d = config.getBounds();

            // #endif JAVA1
        } catch (Throwable t) {
        }
        positionComponent(p, c, d);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

    final int scale = Math.max(MINIMUM_SCALE, Math.min(MAP_HEIGHT / mapHeight, MAP_WIDTH / mapWidth));
    final int width = Math.min(MAP_WIDTH, mapWidth * scale);
    final int height = Math.min(MAP_HEIGHT, mapHeight * scale);
   
    // this.getGraphicsConfiguration is not thread safe
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    // create the map image, and fill it with the wanted details
    final Image newMapImage  = gc.createCompatibleImage(mapWidth * scale, mapHeight * scale);
    final Graphics g = newMapImage.getGraphics();
    g.setColor(COLOR_BACKGROUND);
    g.fillRect(0, 0, mapWidth * scale, mapHeight * scale);
   
    for (int x = 0; x < mapWidth; x++) {
View Full Code Here

Examples of java.awt.GraphicsConfiguration

   * @param description
   * @param category
   * @return the drawn sprite
   */
  public Sprite createAchievementBox(String title, String description, String category) {
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    // Get the category image
    // initialize category image with empty image in case loading the image fails
    BufferedImage categoryImage = gc.createCompatibleImage(32, 32, Transparency.BITMASK);
    String imageName = ACHIEVEMENT_IMAGE_FOLDER + category.toLowerCase(Locale.ENGLISH) + ".png";
    try {
      categoryImage = ImageIO.read(AchievementBoxFactory.class.getClassLoader().getResourceAsStream(imageName));
    } catch (IOException e) {
      Logger.getLogger(AchievementBoxFactory.class).error("Error loading achievement box image: " + imageName, e);
    }
    // Calculate size for the message box
    String fontName = WtWindowManager.getInstance().getProperty("ui.logfont", FONT_NAME);
    Font font = new Font(fontName, Font.PLAIN, 14);
    Font largeFont = font.deriveFont(20f);
    Rectangle2D titleRect = largeFont.getStringBounds(title, graphics.getFontRenderContext());
    Rectangle2D textRect = font.getStringBounds(description, graphics.getFontRenderContext());
    int width = (int) Math.max(titleRect.getWidth(), textRect.getWidth())+categoryImage.getWidth();
    int height = (int) Math.max(categoryImage.getHeight(), (titleRect.getHeight() + textRect.getHeight()));
    width += 2 * SIDE_MARGIN + IMAGE_PAD;
    height += TOP_MARGIN + BOTTOM_MARGIN;
   
    // Create the background sprite
    final BufferedImage image = gc.createCompatibleImage(width, height, Transparency.BITMASK);
    final Graphics2D g2d = image.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setComposite(AlphaComposite.Src);
    BackgroundPainter bp = new BackgroundPainter(BACKGROUND);
    bp.paint(g2d, width, height);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

   
    // Find the actual width of the text
    final int lineLengthPixels = getMaxPixelWidth(formattedLines);
    final int numLines = formattedLines.size();

    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    final int imageWidth;
    if (lineLengthPixels + BUBBLE_OFFSET < width) {
      imageWidth = (lineLengthPixels + BUBBLE_OFFSET) + ARC_DIAMETER;
    } else {
      imageWidth = width + BUBBLE_OFFSET + ARC_DIAMETER;
    }
   
    final int imageHeight = LINE_HEIGHT * numLines + MARGIN_WIDTH;

    final BufferedImage image = gc.createCompatibleImage(imageWidth, imageHeight, Transparency.BITMASK);

    final Graphics2D g2d = image.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    if (fillColor != null) {
View Full Code Here

Examples of java.awt.GraphicsConfiguration

  /**
   * Create a new MainFrame.
   */
  public MainFrame() {
    // Open on the screen where the mouse cursor is
    GraphicsConfiguration gc = MouseInfo.getPointerInfo().getDevice().getDefaultConfiguration();
    mainFrame =  new JFrame(gc);
    initialize();
  }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

 
  /**
   * Create the close and minimize icons
   */
  private static void createIcons() {
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Image bg = createIconBackground(gc);
   
    // copy bg for drawing
    Image image = gc.createCompatibleImage(TITLEBAR_HEIGHT, TITLEBAR_HEIGHT, Transparency.OPAQUE);
    Graphics g = image.getGraphics();
    g.drawImage(bg, 0, 0, null);
    closeIcon = createCloseIcon(image);
   
    // now we can draw over the background image
View Full Code Here

Examples of java.awt.GraphicsConfiguration

    }

    /*
     * Full copy method (the memory hog)
     */
    final GraphicsConfiguration gc = getGC();

    final Image imageTemp = gc.createCompatibleImage(width, height,
        Transparency.BITMASK);

    draw(imageTemp.getGraphics(), 0, 0, x, y, width, height);

    return new ImageSprite(imageTemp, ref);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

   * @param text The text to be rendered
   * @param textColor Color of the text
   * @return TextSprite with the wanted text
   */
  public static TextSprite createTextSprite(String text, final Color textColor) {
    final GraphicsConfiguration gc = getGC();
    final Image image = gc.createCompatibleImage(graphics.getFontMetrics().stringWidth(
        text) + 2, 16, Transparency.BITMASK);
    final Graphics g2d = image.getGraphics();

    drawOutlineString(g2d, textColor, text, 1, 10);

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.