position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
/** * Draws the text block at a specific location. * * @param g2 the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. * @param anchor the anchor point. */ public void draw(final Graphics2D g2, final float x, final float y, final TextBlockAnchor anchor) { draw(g2, x, y, anchor, 0.0f, 0.0f, 0.0); }
/** * Draws the text block at a specific location. * * @param g2 the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. * @param anchor the anchor point. */ public void draw(final Graphics2D g2, final float x, final float y, final TextBlockAnchor anchor) { draw(g2, x, y, anchor, 0.0f, 0.0f, 0.0); }
/** * Draws the text block at a specific location. * * @param g2 the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. * @param anchor the anchor point. */ public void draw(final Graphics2D g2, final float x, final float y, final TextBlockAnchor anchor) { draw(g2, x, y, anchor, 0.0f, 0.0f, 0.0); }
class CustomLegendGraphic extends LegendGraphic { String label; public CustomLegendGraphic(Shape shape, Paint fillPaint, String label) { super(shape, fillPaint); this.label = label; } @Override public Object draw(Graphics2D g2, Rectangle2D area, Object params) { Object result = super.draw(g2, area, params); area = trimMargin(area); Point2D location = RectangleAnchor.coordinates(area, this.getShapeLocation()); TextBlock textBlock = TextUtilities.createTextBlock(label, getItemFont(), Color.white); textBlock.draw(g2, (float)location.getX(), (float)location.getY(), TextBlockAnchor.CENTER); return result; } }
TextBlock notesBlock = TextUtilities.createTextBlock( someLongString, plainFont, g2.getPaint()); notesBlock.setLineAlignment(HorizontalAlignment.LEFT); notesBlock.draw(g2, indent, y, TextBlockAnchor.TOP_LEFT);
/** * Paints the panel. * * @param g the graphics device. */ public void paintComponent(final Graphics g) { super.paintComponent(g); final Graphics2D g2 = (Graphics2D) g; final Dimension size = getSize(); final Insets insets = getInsets(); final Rectangle2D available = new Rectangle2D.Double(insets.left, insets.top, size.getWidth() - insets.left - insets.right, size.getHeight() - insets.top - insets.bottom); final double x = available.getX(); final double y = available.getY(); final float width = (float) available.getWidth(); final TextBlock block = TextUtilities.createTextBlock( this.text, this.font, Color.black, width, new G2TextMeasurer(g2) ); g2.setPaint(Color.black); block.draw(g2, (float) x, (float) y, TextBlockAnchor.TOP_LEFT, 0.0f, 0.0f, 0.0); }
this.content.draw(g2, x, y, anchor);
this.content.draw(g2, x, y, anchor, x, y, -Math.PI / 2.0);
this.textBlock.draw(g2, (float) (xx + this.interiorGap.calculateLeftInset(w)), (float) (yy + this.interiorGap.calculateTopInset(h)),
/** * Draws a message to state that there is no data to plot. * * @param g2 the graphics device. * @param area the area within which the plot should be drawn. */ protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) { Shape savedClip = g2.getClip(); g2.clip(area); String message = this.noDataMessage; if (message != null) { g2.setFont(this.noDataMessageFont); g2.setPaint(this.noDataMessagePaint); TextBlock block = TextUtilities.createTextBlock( this.noDataMessage, this.noDataMessageFont, this.noDataMessagePaint, 0.9f * (float) area.getWidth(), new G2TextMeasurer(g2)); block.draw(g2, (float) area.getCenterX(), (float) area.getCenterY(), TextBlockAnchor.CENTER); } g2.setClip(savedClip); }
this.textBlock.draw(g2, (float) (xx + this.interiorGap.calculateLeftInset(w)), (float) (yy + this.interiorGap.calculateTopInset(h)),
this.textBlock.draw( g2, (float) bounds.getCenterX(), (float) bounds.getCenterY(), TextBlockAnchor.CENTER
g2.setFont(this.font); Point2D pt = RectangleAnchor.coordinates(area, this.textAnchor); this.label.draw(g2, (float) pt.getX(), (float) pt.getY(), this.contentAlignmentPoint); BlockResult result = null;
position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),