mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Window decorations:
- enabled `TitlePane.unifiedBackground` by default (because seems to be standard on Windows 11) - no longer paint a bottom separator for the menu bar (if unified background is enabled)
This commit is contained in:
@@ -13,6 +13,9 @@ FlatLaf Change Log
|
||||
and use them in any component. (PR #388)\
|
||||
E.g.: `mySlider.putClientProperty( "FlatLaf.styleClass", "myclass" );`
|
||||
- Native window decorations (Windows 10/11 only):
|
||||
- Unified backgrounds for window title bar is now enabled by default (window
|
||||
title bar has now same background color as window content). Bottom separator
|
||||
for menu bars is no longer painted (if unified background is enabled).
|
||||
- Show Windows 11 snap layouts menu when hovering the mouse over the maximize
|
||||
button. (issues #397 and #407)
|
||||
- Option to hide window icon (for single window set client property
|
||||
|
||||
@@ -53,6 +53,9 @@ public class FlatMenuBarBorder
|
||||
|
||||
@Override
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||
if( !showBottomSeparator() )
|
||||
return;
|
||||
|
||||
float lineHeight = scale( (float) 1 );
|
||||
FlatUIUtils.paintFilledRectangle( g, borderColor, x, y + height - lineHeight, width, lineHeight );
|
||||
}
|
||||
@@ -68,4 +71,9 @@ public class FlatMenuBarBorder
|
||||
insets.right = scale( margin.right );
|
||||
return insets;
|
||||
}
|
||||
|
||||
/** @since 2 */
|
||||
protected boolean showBottomSeparator() {
|
||||
return !UIManager.getBoolean( "TitlePane.unifiedBackground" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ TitledBorder.border = 1,1,1,1,$Separator.foreground
|
||||
|
||||
TitlePane.useWindowDecorations = true
|
||||
TitlePane.menuBarEmbedded = true
|
||||
TitlePane.unifiedBackground = false
|
||||
TitlePane.unifiedBackground = true
|
||||
TitlePane.showIcon = true
|
||||
TitlePane.noIconLeftGap = 8
|
||||
TitlePane.iconSize = 16,16
|
||||
|
||||
@@ -718,13 +718,11 @@ class DemoFrame
|
||||
|
||||
//---- windowDecorationsCheckBoxMenuItem ----
|
||||
windowDecorationsCheckBoxMenuItem.setText("Window decorations");
|
||||
windowDecorationsCheckBoxMenuItem.setSelected(true);
|
||||
windowDecorationsCheckBoxMenuItem.addActionListener(e -> windowDecorationsChanged());
|
||||
optionsMenu.add(windowDecorationsCheckBoxMenuItem);
|
||||
|
||||
//---- menuBarEmbeddedCheckBoxMenuItem ----
|
||||
menuBarEmbeddedCheckBoxMenuItem.setText("Embedded menu bar");
|
||||
menuBarEmbeddedCheckBoxMenuItem.setSelected(true);
|
||||
menuBarEmbeddedCheckBoxMenuItem.addActionListener(e -> menuBarEmbeddedChanged());
|
||||
optionsMenu.add(menuBarEmbeddedCheckBoxMenuItem);
|
||||
|
||||
@@ -876,6 +874,10 @@ class DemoFrame
|
||||
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
||||
|
||||
if( FlatLaf.supportsNativeWindowDecorations() ) {
|
||||
windowDecorationsCheckBoxMenuItem.setSelected( FlatLaf.isUseNativeWindowDecorations() );
|
||||
menuBarEmbeddedCheckBoxMenuItem.setSelected( UIManager.getBoolean( "TitlePane.menuBarEmbedded" ) );
|
||||
unifiedTitleBarMenuItem.setSelected( UIManager.getBoolean( "TitlePane.unifiedBackground" ) );
|
||||
|
||||
if( JBRCustomDecorations.isSupported() ) {
|
||||
// If the JetBrains Runtime is used, it forces the use of it's own custom
|
||||
// window decoration, which can not disabled.
|
||||
|
||||
@@ -354,7 +354,6 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "windowDecorationsCheckBoxMenuItem"
|
||||
"text": "Window decorations"
|
||||
"selected": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
@@ -363,7 +362,6 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "menuBarEmbeddedCheckBoxMenuItem"
|
||||
"text": "Embedded menu bar"
|
||||
"selected": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
|
||||
@@ -1217,7 +1217,7 @@ TitlePane.noIconLeftGap 8
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.showIcon true
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.unifiedBackground true
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
@@ -1222,7 +1222,7 @@ TitlePane.noIconLeftGap 8
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.showIcon true
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.unifiedBackground true
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
@@ -1237,7 +1237,7 @@ TitlePane.noIconLeftGap 8
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.showIcon true
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.unifiedBackground true
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user