mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui: fix rendering of separators with text on toolbar
Actual text width depends on antialiasing settings.
This commit is contained in:
+11
-2
@@ -985,8 +985,17 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar, QuickAct
|
||||
if (myOrientation == SwingConstants.HORIZONTAL) {
|
||||
if (myText != null) {
|
||||
FontMetrics fontMetrics = getFontMetrics(getFont());
|
||||
return new JBDimension(JBUI.scale(9) + fontMetrics.stringWidth(myText) + JBUI.scale(4),
|
||||
Math.max(fontMetrics.getHeight(), JBUI.scale(24)), true);
|
||||
|
||||
Graphics g = getGraphics().create();
|
||||
try {
|
||||
UISettings.setupAntialiasing(g);
|
||||
int textWidth = fontMetrics.getStringBounds(myText, g).getBounds().width;
|
||||
return new JBDimension(JBUI.scale(9) + textWidth + JBUI.scale(4),
|
||||
Math.max(fontMetrics.getHeight(), JBUI.scale(24)), true);
|
||||
}
|
||||
finally {
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return JBUI.size(7, 24);
|
||||
|
||||
Reference in New Issue
Block a user