Browse Source

Only show visible windows.

Fixed NPE when title is null.
pull/75/head
weisj 5 years ago
parent
commit
251a1a8477
  1. 5
      core/src/main/java/com/github/weisj/darklaf/LafManager.java
  2. 4
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

5
core/src/main/java/com/github/weisj/darklaf/LafManager.java

@ -192,9 +192,10 @@ public final class LafManager {
updateLafRecursively(childWindow); updateLafRecursively(childWindow);
} }
SwingUtilities.updateComponentTreeUI(window); SwingUtilities.updateComponentTreeUI(window);
// Use custom decorations when supported by the LAF //Ensure decorations are applied appropriately.
boolean wasVisible = window.isVisible();
window.dispose(); window.dispose();
window.setVisible(true); window.setVisible(wasVisible);
} }
/** /**

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

@ -637,10 +637,12 @@ public class WindowsTitlePane extends CustomTitlePane {
} }
private boolean hideTitleBar() { private boolean hideTitleBar() {
String title = titleLabel.getText();
if (title == null) title = "";
return windowHandle == 0 return windowHandle == 0
|| (getWindowDecorationStyle() == JRootPane.NONE || (getWindowDecorationStyle() == JRootPane.NONE
&& menuBar == null && menuBar == null
&& titleLabel.getText().length() == 0); && title.length() == 0);
} }
private class TitlePaneLayout implements LayoutManager { private class TitlePaneLayout implements LayoutManager {

Loading…
Cancel
Save