/** * @see Content#draw(Graphics2D) */ @Override public void draw(Graphics2D graphics) { text.draw(graphics, getBounds()); }
/** * Sets the optimal size adapted to the contained text */ private void setOptimalSize() { Rectangle2D minimalBounds = getMinimalBounds(); setWidth(minimalBounds.getWidth()); setHeight(minimalBounds.getHeight()); }
/** * @see LineText.ChangeListener#onChange() */ @Override public void onChange() { refresh(); }
private void drawContent(Graphics2D graphics, TextContent textContent, Point2D startPoint, Point2D endPoint, boolean center) Rectangle2D textBounds = textContent.getBounds(); Direction direction = new Direction(startPoint, endPoint); Direction nearestDirection = direction.getNearestCardinalDirection(); if(center) textContent.draw(graphics, new Point2D.Double(-textContent.getWidth() / 2, -textContent.getHeight())); textContent.draw(graphics, new Point2D.Double(-LABEL_GAP - textContent.getWidth(),-textContent.getHeight())); textContent.draw(graphics, new Point2D.Double(LABEL_GAP,-textContent.getHeight())); textContent.draw(graphics, new Point2D.Double(x,y));
@Override protected void createContentStructure() { TextContent textContent = new TextContent(text); textContent.setMinHeight(DEFAULT_HEIGHT); textContent.setMinWidth(DEFAULT_WIDTH); ContentInsideShape contentInsideShape = new ContentInsideCustomShape(textContent, new ContentInsideCustomShape.ShapeCreator() { @Override public Shape createShape(double contentWidth, double contentHeight) { GeneralPath path = new GeneralPath(); path.moveTo(0, 0); path.lineTo(contentWidth - FOLD_X, 0); path.lineTo(contentWidth, FOLD_Y); path.lineTo(contentWidth, contentHeight); path.lineTo(0, contentHeight); path.closePath(); return path; } }); setBorder(new ContentBorder(contentInsideShape, getBorderColor())); setBackground(new ContentBackground(getBorder(), getBackgroundColor())); setContent(getBackground()); setBackgroundColor(ColorToolsBarPanel.PASTEL_YELLOW_ORANCE.getBackgroundColor()); setBorderColor(ColorToolsBarPanel.PASTEL_YELLOW_ORANCE.getBorderColor()); setTextColor(ColorToolsBarPanel.PASTEL_YELLOW_ORANCE.getTextColor()); }
public LabeledLineEdge() { super(); startLabel = new SingleLineText(); centerLabel = new SingleLineText(); endLabel = new SingleLineText(); startTextContent = new TextContent(startLabel); centerTextContent = new TextContent(centerLabel); endTextContent = new TextContent(endLabel); }
protected LabeledLineEdge(LabeledLineEdge cloned) { super(cloned); this.startLabel = cloned.startLabel.clone(); this.centerLabel = cloned.centerLabel.clone(); this.endLabel = cloned.endLabel.clone(); startTextContent = new TextContent(startLabel); centerTextContent = new TextContent(centerLabel); endTextContent = new TextContent(endLabel); }
@Override protected void createContentStructure() { super.createContentStructure(); startTextContent = new TextContent(startLabel); centerTextContent = new TextContent(centerLabel); endTextContent = new TextContent(endLabel); startLabel.reconstruction(); centerLabel.reconstruction(); endLabel.reconstruction(); }