Package java.awt

Examples of java.awt.Graphics.drawString()


            drawable.setColor(java.awt.Color.black);
            drawable.drawString(
                    "r=" + String.valueOf(fgColor.getRed()) + ",g="
                            + String.valueOf(fgColor.getGreen()) + ",b="
                            + String.valueOf(fgColor.getBlue()), 50, 100);
            drawable.drawString(
                    "r=" + String.valueOf(bgColor.getRed()) + ",g="
                            + String.valueOf(bgColor.getGreen()) + ",b="
                            + String.valueOf(bgColor.getBlue()), 5, 15);

            try {
View Full Code Here


        drawable.setColor(Color.blue);
        drawable.drawRect(0, 0, 199, 199);

        // Use the parameter to create dynamic content.
        drawable.setColor(Color.black);
        drawable.drawString("Time: " + textToDisplay, 75, 100);

        try {
            // Write the image to a buffer.
            ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
            ImageIO.write(image, "png", imagebuffer);
View Full Code Here

        drawable.setColor(Color.blue);
        drawable.drawRect(0, 0, 199, 199);

        // Use the parameter to create dynamic content.
        drawable.setColor(Color.black);
        drawable.drawString("Tex", 75, 100);

        try {
            // Write the image to a buffer.
            ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
            ImageIO.write(image, "png", imagebuffer);
View Full Code Here

          graphics.setColor(Color.YELLOW);
          graphics.fillRect(0,0,image.getWidth(),image.getHeight());
          Font serif = new Font("serif", Font.PLAIN, 30);
          graphics.setFont(serif);
          graphics.setColor(Color.BLUE);
          graphics.drawString(text, 10, 50);
          return image;
      }

      private String generateString(IoSession session, int length) {
          Integer index = (Integer) session.getAttribute(INDEX_KEY);
View Full Code Here

                fps = fc;
                fc = 0;
            }
            fc++;
            wGrp.setColor(Color.yellow);
            wGrp.drawString("FPS: " + fps + " (FRRH: " + pFrameRateRatioHint + ")", 0, height - 1);
        }
        if (getGraphics() != null) getGraphics().drawImage(getDoubleBuffer(), 0, 0, null);
        //      repaint();
        //      try {
        //          EventQueue.invokeLater( new AWTPaintSynchronizer() );
View Full Code Here

    g.setFont(new Font("Dialog", Font.PLAIN, 12));

    FontMetrics metrics = g.getFontMetrics();
    int baseline = metrics.getAscent();

    g.drawString("X", 0, baseline);

    // Now that we have rendered the glyphs, we examine the
    // image to see how many lines of padding we've got.
    int top = 0;
    for (int y = 0; y < height; y++)
View Full Code Here

      file = new File("JSProfilePicUpdate" + System.currentTimeMillis()
          + ".jpg");
      BufferedImage image = new BufferedImage(100, 100,
          BufferedImage.TYPE_INT_RGB);
      Graphics g = image.getGraphics();
      g.drawString("Hello World!!!", 10, 20);
      ImageIO.write(image, "jpg", file);     
    } catch (FileNotFoundException e) {
      Assert.fail("Error creating test file: " + e.getMessage());
      e.printStackTrace();
    } catch (IOException e) {
View Full Code Here

        graphics.setColor(Color.YELLOW);
        graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
        Font serif = new Font("serif", Font.PLAIN, 30);
        graphics.setFont(serif);
        graphics.setColor(Color.BLUE);
        graphics.drawString(text, 10, 50);
        return image;
    }

    /**
     * Generate a string based on the 'characters' field in this class.  The
View Full Code Here

      final int xspace = (int) Math.max(IMAGE_SIZE - stringBounds.getWidth(), 0);
      final int yspace = (int) Math.max(IMAGE_SIZE - stringBounds.getHeight(), 0);
      graphics.setColor(Color.BLACK);
      final double y2 = stringBounds.getY();
      final int y1 = (int) ((yspace / 2) - y2);
      graphics.drawString(symbol, xspace / 2, y1);
      graphics.dispose();
      return new ImageIcon(bi);
    }
  }
View Full Code Here

        {
            g.setColor(Color.LIGHT_GRAY);
            String msg = Translater.getString("updater.newUpdateAvailable");
            g.setFont(new Font(null, 1, 20));
            FontMetrics fm = g.getFontMetrics();
            g.drawString(msg, w / 2 - fm.stringWidth(msg) / 2,
                    h / 2 - fm.getHeight() * 2);
           
            g.setFont(new Font(null, 0, 12));
            fm = g.getFontMetrics();
           
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.