boreders. font is larger.

This commit is contained in:
Evgeny Zakrevsky
2011-08-12 15:04:01 +04:00
parent c8aa20b7dd
commit 04bd7e7d9e
3 changed files with 12 additions and 7 deletions
@@ -58,13 +58,10 @@ public class IdeBorderFactory {
}
public static IdeaTitledBorder createTitledBorder(String title, boolean hasBoldFont, boolean hasIndent, boolean hasSmallFont) {
Font font = UIUtil.getBorderFont();
Font font = UIUtil.getBorderFont(hasSmallFont ? UIUtil.FontSize.SMALL : UIUtil.FontSize.NORMAL);
if (hasBoldFont) {
font = font.deriveFont(Font.BOLD);
}
if (hasSmallFont) {
font = UIUtil.getFont(UIUtil.FontSize.SMALL, font);
}
int indent = hasIndent ? (hasBoldFont ? 18 : 15) : 0;
Insets insets = hasBoldFont ? new Insets(5,0,10,0) : new Insets(3,0,6,0);
return new IdeaTitledBorder(title, font, UIUtil.getBorderColor(), indent, 1, insets);
@@ -51,9 +51,8 @@ public class TitledSeparator extends JPanel {
setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 5, 5));
setText(text);
setTitleFont(UIUtil.getBorderFont());
setBoldFont(boldFont);
setSmallFont(smallFont);
setBoldFont(boldFont);
}
public String getText() {
@@ -87,7 +86,7 @@ public class TitledSeparator extends JPanel {
public void setSmallFont(boolean smallFont) {
this.smallFont = smallFont;
this.setTitleFont(UIUtil.getFont(smallFont ? UIUtil.FontSize.SMALL : UIUtil.FontSize.NORMAL, this.getTitleFont()));
this.setTitleFont(UIUtil.getBorderFont(smallFont ? UIUtil.FontSize.SMALL : UIUtil.FontSize.NORMAL));
}
}
@@ -289,6 +289,15 @@ public class UIUtil {
}
}
@NotNull
public static Font getBorderFont(@NotNull FontSize size) {
Font defFont = getBorderFont();
if (size == FontSize.SMALL) {
return defFont.deriveFont(defFont.getSize() * 0.9f);
}
return defFont;
}
public static Font getLabelFont() {
return UIManager.getFont("Label.font");
}