public static int getMinimumHeight(IFigure figure) { int height = figure.getBounds().height; if (figure instanceof FlowPage) { FlowPage fp = (FlowPage) figure; TextFlow tf = (TextFlow) fp.getChildren().get(0); Dimension textExtents = TextUtilities.INSTANCE.getTextExtents(tf.getText(), tf.getFont()); List<?> fragments = tf.getFragments(); if (fragments.size() != 0) { height = fragments.size() * textExtents.height; // include border padding height = height + figure.getBorder().getInsets(figure).getHeight(); } } return height; }
@Override protected void paintFigure(Graphics graphics) { if (roiInfoProvider != null && roiDataBounds != null) { String text = roiInfoProvider.getROIInfo( roiDataBounds.x, roiDataBounds.y, roiDataBounds.width, roiDataBounds.height); Dimension size = TextUtilities.INSTANCE.getTextExtents(text, getFont()); graphics.pushState(); graphics.translate(getLocation()); graphics.fillRectangle(roiGeoBounds.x, roiGeoBounds.y - size.height, size.width, size.height); graphics.drawText(text, roiGeoBounds.x, roiGeoBounds.y - size.height); graphics.popState(); } super.paintFigure(graphics); }