|
|
@ -56,6 +56,7 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
private final JRootPane rootPane; |
|
|
|
private final JRootPane rootPane; |
|
|
|
|
|
|
|
|
|
|
|
private boolean unifiedMenuBar; |
|
|
|
private boolean unifiedMenuBar; |
|
|
|
|
|
|
|
private boolean titleBarHidden; |
|
|
|
private ContainerListener rootPaneContainerListener; |
|
|
|
private ContainerListener rootPaneContainerListener; |
|
|
|
private ContainerListener layeredPaneContainerListener; |
|
|
|
private ContainerListener layeredPaneContainerListener; |
|
|
|
|
|
|
|
|
|
|
@ -105,6 +106,7 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
oldResizable = true; |
|
|
|
oldResizable = true; |
|
|
|
installSubcomponents(); |
|
|
|
installSubcomponents(); |
|
|
|
updateMenuBar(true); |
|
|
|
updateMenuBar(true); |
|
|
|
|
|
|
|
updateTitleBarVisibility(); |
|
|
|
installDefaults(); |
|
|
|
installDefaults(); |
|
|
|
setLayout(createLayout()); |
|
|
|
setLayout(createLayout()); |
|
|
|
} |
|
|
|
} |
|
|
@ -133,6 +135,12 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
rootPane.revalidate(); |
|
|
|
rootPane.revalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateTitleBarVisibility() { |
|
|
|
|
|
|
|
titleBarHidden = PropertyUtil.getBooleanProperty(rootPane, "JRootPane.hideTitleBar"); |
|
|
|
|
|
|
|
rootPane.doLayout(); |
|
|
|
|
|
|
|
rootPane.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ContainerListener createRootPaneContainerListener() { |
|
|
|
private ContainerListener createRootPaneContainerListener() { |
|
|
|
return new ContainerListener() { |
|
|
|
return new ContainerListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -247,6 +255,9 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
determineColors(); |
|
|
|
determineColors(); |
|
|
|
setActive(window.isActive()); |
|
|
|
setActive(window.isActive()); |
|
|
|
installListeners(); |
|
|
|
installListeners(); |
|
|
|
|
|
|
|
if (getComponentCount() == 0) { |
|
|
|
|
|
|
|
addComponents(); |
|
|
|
|
|
|
|
} |
|
|
|
updateSystemIcon(getGraphicsConfiguration()); |
|
|
|
updateSystemIcon(getGraphicsConfiguration()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -305,16 +316,20 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
private void installSubcomponents() { |
|
|
|
private void installSubcomponents() { |
|
|
|
titleLabel = new JLabel(); |
|
|
|
titleLabel = new JLabel(); |
|
|
|
titleLabel.setHorizontalAlignment(JLabel.LEFT); |
|
|
|
titleLabel.setHorizontalAlignment(JLabel.LEFT); |
|
|
|
add(titleLabel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createIcons(); |
|
|
|
createIcons(); |
|
|
|
createActions(); |
|
|
|
createActions(); |
|
|
|
createButtons(); |
|
|
|
createButtons(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addComponents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addComponents() { |
|
|
|
add(windowIconButton); |
|
|
|
add(windowIconButton); |
|
|
|
add(minimizeButton); |
|
|
|
add(minimizeButton); |
|
|
|
add(maximizeToggleButton); |
|
|
|
add(maximizeToggleButton); |
|
|
|
add(closeButton); |
|
|
|
add(closeButton); |
|
|
|
|
|
|
|
add(titleLabel); |
|
|
|
setComponentZOrder(closeButton, 0); |
|
|
|
setComponentZOrder(closeButton, 0); |
|
|
|
setComponentZOrder(maximizeToggleButton, 1); |
|
|
|
setComponentZOrder(maximizeToggleButton, 1); |
|
|
|
setComponentZOrder(minimizeButton, 2); |
|
|
|
setComponentZOrder(minimizeButton, 2); |
|
|
@ -697,14 +712,14 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean hideTitleBar() { |
|
|
|
private boolean hideTitleBar() { |
|
|
|
|
|
|
|
if (titleBarHidden) return true; |
|
|
|
String title = titleLabel.getText(); |
|
|
|
String title = titleLabel.getText(); |
|
|
|
if (title == null) title = ""; |
|
|
|
if (title == null) title = ""; |
|
|
|
return windowHandle == 0 || (getDecorationStyle() == JRootPane.NONE && (menuBar == null || !menuBar.isVisible()) |
|
|
|
|
|
|
|
&& title.length() == 0) |
|
|
|
|
|
|
|
// e.g. VCLJ achieves fullscreen by hiding the titlebar through jni and setting visibility
|
|
|
|
// e.g. VCLJ achieves fullscreen by hiding the titlebar through jni and setting visibility
|
|
|
|
// of
|
|
|
|
// of the menubar.
|
|
|
|
// the menubar.
|
|
|
|
boolean emptyMenuBar = !unifiedMenuBar || menuBar == null || !menuBar.isVisible(); |
|
|
|
|| (menuBar != null && !menuBar.isVisible()); |
|
|
|
boolean emptyContent = getDecorationStyle() == JRootPane.NONE && emptyMenuBar && title.length() == 0; |
|
|
|
|
|
|
|
return windowHandle == 0 || emptyContent || (menuBar != null && !menuBar.isVisible()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -905,6 +920,8 @@ public class WindowsTitlePane extends CustomTitlePane { |
|
|
|
public void propertyChange(final PropertyChangeEvent evt) { |
|
|
|
public void propertyChange(final PropertyChangeEvent evt) { |
|
|
|
if ("JRootPane.unifiedMenuBar".equals(evt.getPropertyName())) { |
|
|
|
if ("JRootPane.unifiedMenuBar".equals(evt.getPropertyName())) { |
|
|
|
updateMenuBar(true); |
|
|
|
updateMenuBar(true); |
|
|
|
|
|
|
|
} else if ("JRootPane.hideTitleBar".equals(evt.getPropertyName())) { |
|
|
|
|
|
|
|
updateTitleBarVisibility(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|