Package java.awt

Examples of java.awt.Graphics2D.drawString()


    g2.setTransform(AffineTransform.getTranslateInstance(20, 20));
    radio.paint(g2);
    g2.setTransform(AffineTransform.getTranslateInstance(0, 0));
    g2.setPaint(Color.green);
    g2.setFont(new Font("Serif", Font.PLAIN, 10));
    g2.drawString("You are viewing a graphics of JFreeReport on index "
        + event.getState().getCurrentRow(), 10, 10);
    g2.dispose();
    try
    {
      functionValue = new DefaultImageReference(image);
View Full Code Here


      graphics.setColor(state.getTextColor());
    }
    // System.out.println("X: " + x + " Y: " + p.y + " " + calcDeltaY(state.getHorizontalTextAlignment(), metrics));

    final Graphics2D g2 = (Graphics2D) graphics.create();
    g2.drawString(text, x, y);

    if (lFont.isUnderline())
    {  // Underline.
      y += metrics.getDescent() / 8 + 1;
      //state.prepareDraw();
View Full Code Here

        isNormalTextSpacing(renderableText))
    {
      final int maxLength = renderableText.computeMaximumTextSize(contentX2);
      final String text = gs.getText(renderableText.getOffset(), maxLength, codePointBuffer);
      final float y = (float) StrictGeomUtility.toExternalValue(posY + awtBaseLine);
      g2.drawString(text, (float) StrictGeomUtility.toExternalValue(posX), y);
    }
    else
    {
      final ExtendedBaselineInfo baselineInfo = renderableText.getBaselineInfo();
      final int maxPos = renderableText.getOffset() + renderableText.computeMaximumTextSize(contentX2);
View Full Code Here

      final float y = (float) (StrictGeomUtility.toExternalValue
          (posY + awtBaseLine + baselineDelta));
      for (int i = renderableText.getOffset(); i < maxPos; i++)
      {
        final Glyph g = gs.getGlyph(i);
        g2.drawString(gs.getGlyphAsString(i, codePointBuffer),
            (float) StrictGeomUtility.toExternalValue(runningPos), y);
        runningPos += RenderableText.convert(g.getWidth()) + g.getSpacing().getMinimum();
      }
    }
    g2.dispose();
View Full Code Here

    final Graphics2D graphics = file.getGraphics2D();
    final MfDcState state = file.getCurrentState();

    state.prepareDrawText();
    graphics.drawString(text, x, y);
    state.postDrawText();
  }

  /**
   * Creates a empty unintialized copy of this command implementation.
View Full Code Here

            final int SW = Math.max(getIconWidth()/10, 4);
            g.setStroke(new BasicStroke(SW));
            g.drawArc(SW/2, SW/2, getIconWidth()-SW-1, getIconHeight()-SW-1, 0, 360);
            Rectangle2D bounds =
                font.getStringBounds("i", g.getFontRenderContext());
            g.drawString("i", Math.round((getIconWidth() - bounds.getWidth())/2 - getIconWidth()/12),
                         SW/2 + Math.round((getIconHeight()-bounds.getHeight())/2 - bounds.getY() + getIconHeight()/8));
            g.dispose();
        }
    }
    public static void main(String[] args) {
View Full Code Here

            int numbers = radius * 3 / 4;
            for (int i=0;i < 12;i++) {
                double theta = Math.PI*2*i/12;
                String str = getRomanNumeral((i+2)%12+1);
                Rectangle2D rect = g.getFontMetrics().getStringBounds(str, g);
                g.drawString(str, Math.round(numbers*Math.cos(theta)-rect.getWidth()/2),
                             Math.round(numbers*Math.sin(theta)+margin*2));
            }
            for (int i=0;i < 60;i++) {
                g.setColor(getForeground());
                g.setStroke(ticks);
View Full Code Here

        FontMetrics metrics = g.getFontMetrics();
          String appendInfo = getPrintableExifInfo(vo);
          if(!StringUtil.isNullOrBlank(appendInfo)){
            int infoWidth = metrics.stringWidth(appendInfo);
            int infoAscent = metrics.getAscent();
            g.drawString(appendInfo,targetWidth-infoWidth-4,targetHeight-EXIF_SIZE_FOOT/2+infoAscent/2);
          }
          //dispose Graphics2D instance and context
          g.dispose();
          vo.setBufferedImage(targetImg);
    } catch (Exception e) {
View Full Code Here

        FontMetrics metrics = g.getFontMetrics();
          String appendInfo = getPrintableExifInfo(vo);
          if(!StringUtil.isNullOrBlank(appendInfo)){
            int infoWidth = metrics.stringWidth(appendInfo);
            int infoAscent = metrics.getAscent();
            g.drawString(appendInfo,targetWidth-infoWidth-4,targetHeight-EXIF_SIZE_FOOT/2+infoAscent/2);
          }
          //dispose Graphics2D instance and context
          g.dispose();
          vo.setBufferedImage(targetImg);
    } catch (Exception e) {
View Full Code Here

          String appendInfo = getPrintableExifInfo(vo);
          if(!StringUtil.isNullOrBlank(appendInfo)){
            FontMetrics metrics = g.getFontMetrics();
            int infoWidth = metrics.stringWidth(appendInfo);
            int infoAscent = metrics.getAscent();
            g.drawString(appendInfo,targetWidth-infoWidth-EXIF_SIZE_SIDE-4,targetHeight-EXIF_SIZE_FOOT/2+infoAscent/2);
          }
          //dispose Graphics2D instance and context
          g.dispose();
          vo.setBufferedImage(targetImg);
    } catch (Exception e) {
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.