|
|
|
@ -27,6 +27,7 @@ public class HeaderPane extends JPanel {
|
|
|
|
|
private int fontSize; |
|
|
|
|
private final Icon triangleDown; |
|
|
|
|
private final Icon triangleRight; |
|
|
|
|
private static final int ICON_FIX = -2; |
|
|
|
|
|
|
|
|
|
public void setPressed(boolean pressed) { |
|
|
|
|
this.isPressed = pressed; |
|
|
|
@ -56,10 +57,11 @@ public class HeaderPane extends JPanel {
|
|
|
|
|
g2d.fillRect(0, insets.top / 2, this.getWidth(), this.getHeight() - (insets.top + insets.bottom) / 2); |
|
|
|
|
|
|
|
|
|
int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2; |
|
|
|
|
// 折叠面板需要icon显示左边缘对齐,fix一下
|
|
|
|
|
if (this.isShow) { |
|
|
|
|
triangleDown.paintIcon(this, g2d, 0, iconY); |
|
|
|
|
triangleDown.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY); |
|
|
|
|
} else { |
|
|
|
|
triangleRight.paintIcon(this, g2d, 0, iconY); |
|
|
|
|
triangleRight.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g2d.setFont(getFont()); |
|
|
|
@ -70,7 +72,7 @@ public class HeaderPane extends JPanel {
|
|
|
|
|
int ascent = metrics.getAscent(); |
|
|
|
|
int descent = metrics.getDescent(); |
|
|
|
|
|
|
|
|
|
float titleX = triangleDown.getIconWidth() |
|
|
|
|
float titleX = triangleDown.getIconWidth() + FineUIScale.scale(ICON_FIX) |
|
|
|
|
+ FineUIScale.scale(UIManager.getInt("ExpandablePane.HeaderPane.hGap")); |
|
|
|
|
float titleY = (getHeight() - (ascent + descent)) / 2.0f + ascent; |
|
|
|
|
FlatUIUtils.setRenderingHints(g2d); |
|
|
|
|