|
|
|
@ -17,9 +17,10 @@ import java.awt.geom.RoundRectangle2D;
|
|
|
|
|
public class FormSpacingLineDrawer { |
|
|
|
|
private static final Color LINE_COLOR = new Color(230, 82, 81); |
|
|
|
|
private static final Color TEXT_COLOR = new Color(255, 255, 255); |
|
|
|
|
private static final int TEXT_PADDING_HORIZONTAL = 6; |
|
|
|
|
private static final int TEXT_PADDING_VERTICAL = 1; |
|
|
|
|
private static final int TEXT_PADDING_HORIZONTAL = 8; |
|
|
|
|
private static final int TEXT_PADDING_VERTICAL = 2; |
|
|
|
|
private static final int MIN_SPACING = 10; |
|
|
|
|
private static final float TIP_FONT_SIZE = 10F; |
|
|
|
|
|
|
|
|
|
private FormDesigner designer; |
|
|
|
|
private XCreator hoverCreator = null; |
|
|
|
@ -109,7 +110,7 @@ public class FormSpacingLineDrawer {
|
|
|
|
|
private void drawSpacingText(Graphics g, String text, int x, int y) { |
|
|
|
|
Graphics2D g2d = (Graphics2D) g.create(); |
|
|
|
|
g2d.setColor(LINE_COLOR); |
|
|
|
|
Font newFont = g2d.getFont().deriveFont(8F).deriveFont(Font.BOLD); |
|
|
|
|
Font newFont = g2d.getFont().deriveFont(TIP_FONT_SIZE).deriveFont(Font.BOLD); |
|
|
|
|
g2d.setFont(newFont); |
|
|
|
|
FontMetrics metrics = g2d.getFontMetrics(); |
|
|
|
|
int lineHeight = metrics.getAscent(); // 这里由于都是数字,要居中必须忽略掉leading和descent的高度
|
|
|
|
|