Browse Source

Decorations: Adjust windows titlepane to height of title font

jnf_util_static
Jannis Weis 3 years ago
parent
commit
269e854279
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 9
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

9
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -254,6 +254,7 @@ public class WindowsTitlePane extends CustomTitlePane {
private void installSubcomponents() {
titleLabel = new JLabel();
titleLabel.setHorizontalAlignment(JLabel.LEFT);
titleLabel.setFont(getFont());
createIcons();
createActions();
@ -311,6 +312,12 @@ public class WindowsTitlePane extends CustomTitlePane {
setFont(UIManager.getFont("InternalFrame.titleFont", getLocale()));
}
@Override
public void setFont(final Font font) {
super.setFont(font);
if (titleLabel != null) titleLabel.setFont(font);
}
protected JButton createWindowIcon() {
JButton button = new JButton();
button.putClientProperty("JButton.noShadowOverwrite", true);
@ -702,7 +709,7 @@ public class WindowsTitlePane extends CustomTitlePane {
private int computeHeight() {
if (hideTitleBar()) return 0;
FontMetrics fm = rootPane.getFontMetrics(getFont());
FontMetrics fm = titleLabel.getFontMetrics(titleLabel.getFont());
int height = fm.getHeight() + 7;
if (menuBarStealer.hasMenuBar()) {
height = Math.max(height, menuBarStealer.getMenuBar().getMinimumSize().height);

Loading…
Cancel
Save