mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Theme Editor: on macOS, use larger window title bar (PR #779)
This commit is contained in:
@@ -10,6 +10,7 @@ FlatLaf Change Log
|
||||
- Label: Support painting background with rounded corners. (issue #842)
|
||||
- Popup: Fixed flicker of popups (e.g. tooltips) while they are moving (e.g.
|
||||
following mouse pointer). (issues #832 and #672)
|
||||
- Theme Editor: On macOS, use larger window title bar. (PR #779)
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.Cursor;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Insets;
|
||||
@@ -191,22 +192,20 @@ class FlatThemeFileEditor
|
||||
|
||||
if( SystemInfo.isMacFullWindowContentSupported ) {
|
||||
// expand window content into window title bar and make title bar transparent
|
||||
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
||||
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
||||
rootPane.putClientProperty( "apple.awt.fullWindowContent", true );
|
||||
rootPane.putClientProperty( "apple.awt.transparentTitleBar", true );
|
||||
rootPane.putClientProperty( FlatClientProperties.MACOS_WINDOW_BUTTONS_SPACING, FlatClientProperties.MACOS_WINDOW_BUTTONS_SPACING_LARGE );
|
||||
|
||||
// hide window title
|
||||
if( SystemInfo.isJava_17_orLater )
|
||||
getRootPane().putClientProperty( "apple.awt.windowTitleVisible", false );
|
||||
rootPane.putClientProperty( "apple.awt.windowTitleVisible", false );
|
||||
else
|
||||
setTitle( null );
|
||||
|
||||
// add gap to left side of toolbar
|
||||
controlPanel.add( Box.createHorizontalStrut( 70 ), 0 );
|
||||
}
|
||||
|
||||
// enable full screen mode for this window (for Java 8 - 10; not necessary for Java 11+)
|
||||
if( !SystemInfo.isJava_11_orLater )
|
||||
getRootPane().putClientProperty( "apple.awt.fullscreenable", true );
|
||||
rootPane.putClientProperty( "apple.awt.fullscreenable", true );
|
||||
}
|
||||
|
||||
// integrate into macOS screen menu
|
||||
@@ -1021,6 +1020,7 @@ class FlatThemeFileEditor
|
||||
helpMenu = new JMenu();
|
||||
aboutMenuItem = new JMenuItem();
|
||||
controlPanel = new JPanel();
|
||||
JPanel macFullWindowContentButtonsPlaceholder = new JPanel();
|
||||
directoryLabel = new JLabel();
|
||||
directoryField = new FlatThemeFileEditor.DirectoryComboBox();
|
||||
openDirectoryButton = new JButton();
|
||||
@@ -1224,7 +1224,7 @@ class FlatThemeFileEditor
|
||||
//======== controlPanel ========
|
||||
{
|
||||
controlPanel.setLayout(new MigLayout(
|
||||
"hidemode 3",
|
||||
"insets panel,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[grow,fill]" +
|
||||
@@ -1232,6 +1232,12 @@ class FlatThemeFileEditor
|
||||
// rows
|
||||
"[]"));
|
||||
|
||||
//======== macFullWindowContentButtonsPlaceholder ========
|
||||
{
|
||||
macFullWindowContentButtonsPlaceholder.setLayout(new FlowLayout());
|
||||
}
|
||||
controlPanel.add(macFullWindowContentButtonsPlaceholder, "west");
|
||||
|
||||
//---- directoryLabel ----
|
||||
directoryLabel.setText("Directory:");
|
||||
controlPanel.add(directoryLabel, "cell 0 0");
|
||||
@@ -1264,6 +1270,9 @@ class FlatThemeFileEditor
|
||||
lafButtonGroup.add(lightLafMenuItem);
|
||||
lafButtonGroup.add(darkLafMenuItem);
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
|
||||
// on macOS, panel on left side of control bar is a placeholder for title bar buttons in fullWindowContent mode
|
||||
macFullWindowContentButtonsPlaceholder.putClientProperty( FlatClientProperties.FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER, "mac" );
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
|
||||
@@ -13,11 +13,19 @@ new FormModel {
|
||||
addEvent( new FormEvent( "java.awt.event.WindowListener", "windowDeactivated", "windowDeactivated", false ) )
|
||||
addEvent( new FormEvent( "java.awt.event.WindowListener", "windowActivated", "windowActivated", false ) )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$layoutConstraints": "insets panel,hidemode 3"
|
||||
"$columnConstraints": "[fill][grow,fill][fill]"
|
||||
"$rowConstraints": "[]"
|
||||
} ) {
|
||||
name: "controlPanel"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
|
||||
name: "macFullWindowContentButtonsPlaceholder"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": true
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "west"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "directoryLabel"
|
||||
"text": "Directory:"
|
||||
|
||||
Reference in New Issue
Block a user