mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Window decorations: support unified backgrounds for window title bar, menu bar and main content (issue #254)
This commit is contained in:
22
CHANGELOG.md
22
CHANGELOG.md
@@ -5,14 +5,20 @@ FlatLaf Change Log
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
- Native window decorations for Windows 10 enables dark frame/dialog title bar
|
||||
and embedded menu bar with all JREs, while still having native Windows 10
|
||||
border drop shadows, resize behavior, window snapping and system window menu.
|
||||
(PR #267)
|
||||
- Custom window decorations: Support right aligned components in `JFrame` title
|
||||
bar with embedded menu bar (using `Box.createHorizontalGlue()`). (PR #268)
|
||||
- Custom window decorations: Improved centering of window title with embedded
|
||||
menu bar. (issue #252)
|
||||
- Windows 10 only:
|
||||
- Native window decorations for Windows 10 enables dark frame/dialog title bar
|
||||
and embedded menu bar with all JREs, while still having native Windows 10
|
||||
border drop shadows, resize behavior, window snapping and system window
|
||||
menu. (PR #267)
|
||||
- Custom window decorations: Support right aligned components in `JFrame`
|
||||
title bar with embedded menu bar (using `Box.createHorizontalGlue()`). (PR
|
||||
#268)
|
||||
- Custom window decorations: Improved centering of window title with embedded
|
||||
menu bar. (PR #268; issue #252)
|
||||
- Custom window decorations: Support unified backgrounds for window title bar,
|
||||
menu bar and main content. If enabled with `UIManager.put(
|
||||
"TitlePane.unifiedBackground", true );` then window title bar and menu bar
|
||||
use same background color as main content. (PR #268; issue #254)
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
|
||||
@@ -23,14 +23,16 @@ import javax.swing.ActionMap;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.MenuElement;
|
||||
import javax.swing.MenuSelectionManager;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ActionMapUIResource;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicMenuBarUI;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
|
||||
@@ -43,12 +45,15 @@ import com.formdev.flatlaf.util.SystemInfo;
|
||||
* @uiDefault MenuBar.background Color
|
||||
* @uiDefault MenuBar.foreground Color
|
||||
* @uiDefault MenuBar.border Border
|
||||
* @uiDefault TitlePane.unifiedBackground boolean
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenuBarUI
|
||||
extends BasicMenuBarUI
|
||||
{
|
||||
protected boolean unifiedBackground;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatMenuBarUI();
|
||||
}
|
||||
@@ -63,6 +68,8 @@ public class FlatMenuBarUI
|
||||
super.installDefaults();
|
||||
|
||||
LookAndFeel.installProperty( menuBar, "opaque", false );
|
||||
|
||||
unifiedBackground = UIManager.getBoolean( "TitlePane.unifiedBackground" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,9 +87,7 @@ public class FlatMenuBarUI
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
// do not fill background if menubar is embedded into title pane
|
||||
if( c.isOpaque() ||
|
||||
!FlatClientProperties.clientPropertyBoolean( menuBar, "flatlaf.internal.menuBarEmbedded", false ) )
|
||||
{
|
||||
if( isFillBackground( c ) ) {
|
||||
g.setColor( c.getBackground() );
|
||||
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
|
||||
}
|
||||
@@ -90,6 +95,24 @@ public class FlatMenuBarUI
|
||||
paint( g, c );
|
||||
}
|
||||
|
||||
protected boolean isFillBackground( JComponent c ) {
|
||||
// paint background in opaque or having custom background color
|
||||
if( c.isOpaque() || !(c.getBackground() instanceof UIResource) )
|
||||
return true;
|
||||
|
||||
// do not paint background for unified title pane
|
||||
if( unifiedBackground )
|
||||
return false;
|
||||
|
||||
// paint background in full screen mode
|
||||
JRootPane rootPane = SwingUtilities.getRootPane( c );
|
||||
if( rootPane == null || FlatUIUtils.isFullScreen( rootPane ) )
|
||||
return true;
|
||||
|
||||
// do not paint background if menu bar is embedded into title pane
|
||||
return rootPane.getJMenuBar() != c || !FlatRootPaneUI.isMenuBarEmbedded( rootPane );
|
||||
}
|
||||
|
||||
//---- class TakeFocus ----------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,7 @@ import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.BorderUIResource;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.RootPaneUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicRootPaneUI;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
@@ -227,6 +228,13 @@ public class FlatRootPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
protected static boolean isMenuBarEmbedded( JRootPane rootPane ) {
|
||||
RootPaneUI ui = rootPane.getUI();
|
||||
return ui instanceof FlatRootPaneUI &&
|
||||
((FlatRootPaneUI)ui).titlePane != null &&
|
||||
((FlatRootPaneUI)ui).titlePane.isMenuBarEmbedded();
|
||||
}
|
||||
|
||||
//---- class FlatRootLayout -----------------------------------------------
|
||||
|
||||
protected class FlatRootLayout
|
||||
@@ -297,10 +305,10 @@ public class FlatRootPaneUI
|
||||
rootPane.getGlassPane().setBounds( x, y, width, height );
|
||||
|
||||
int nextY = 0;
|
||||
if( !isFullScreen && titlePane != null ) {
|
||||
Dimension prefSize = titlePane.getPreferredSize();
|
||||
titlePane.setBounds( 0, 0, width, prefSize.height );
|
||||
nextY += prefSize.height;
|
||||
if( titlePane != null ) {
|
||||
int prefHeight = !isFullScreen ? titlePane.getPreferredSize().height : 0;
|
||||
titlePane.setBounds( 0, 0, width, prefHeight );
|
||||
nextY += prefHeight;
|
||||
}
|
||||
|
||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||
@@ -314,9 +322,6 @@ public class FlatRootPaneUI
|
||||
menuBar.setBounds( 0, nextY, width, prefSize.height );
|
||||
nextY += prefSize.height;
|
||||
}
|
||||
|
||||
// mark menubar as embedded, which is used when painting menubar background
|
||||
menuBar.putClientProperty( "flatlaf.internal.menuBarEmbedded", embedded ? true : null );
|
||||
}
|
||||
|
||||
Container contentPane = rootPane.getContentPane();
|
||||
@@ -346,6 +351,9 @@ public class FlatRootPaneUI
|
||||
|
||||
//---- class FlatWindowBorder ---------------------------------------------
|
||||
|
||||
/**
|
||||
* Window border used for non-native window decorations.
|
||||
*/
|
||||
public static class FlatWindowBorder
|
||||
extends BorderUIResource.EmptyBorderUIResource
|
||||
{
|
||||
@@ -360,7 +368,7 @@ public class FlatRootPaneUI
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
if( isWindowMaximized( c ) || FlatUIUtils.isFullScreen( c ) ) {
|
||||
// hide border if window is maximized
|
||||
// hide border if window is maximized or full screen
|
||||
insets.top = insets.left = insets.bottom = insets.right = 0;
|
||||
return insets;
|
||||
} else
|
||||
|
||||
@@ -78,6 +78,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault TitlePane.inactiveForeground Color
|
||||
* @uiDefault TitlePane.embeddedForeground Color
|
||||
* @uiDefault TitlePane.borderColor Color optional
|
||||
* @uiDefault TitlePane.unifiedBackground boolean
|
||||
* @uiDefault TitlePane.iconSize Dimension
|
||||
* @uiDefault TitlePane.iconMargins Insets
|
||||
* @uiDefault TitlePane.titleMargins Insets
|
||||
@@ -103,6 +104,7 @@ public class FlatTitlePane
|
||||
protected final Color embeddedForeground = UIManager.getColor( "TitlePane.embeddedForeground" );
|
||||
protected final Color borderColor = UIManager.getColor( "TitlePane.borderColor" );
|
||||
|
||||
protected final boolean unifiedBackground = UIManager.getBoolean( "TitlePane.unifiedBackground" );
|
||||
protected final Dimension iconSize = UIManager.getDimension( "TitlePane.iconSize" );
|
||||
protected final int buttonMaximizedHeight = UIManager.getInt( "TitlePane.buttonMaximizedHeight" );
|
||||
protected final boolean centerTitle = UIManager.getBoolean( "TitlePane.centerTitle" );
|
||||
@@ -511,8 +513,10 @@ debug*/
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
g.setColor( getBackground() );
|
||||
g.fillRect( 0, 0, getWidth(), getHeight() );
|
||||
if( !unifiedBackground ) {
|
||||
g.setColor( getBackground() );
|
||||
g.fillRect( 0, 0, getWidth(), getHeight() );
|
||||
}
|
||||
}
|
||||
|
||||
protected void repaintWindowBorder() {
|
||||
|
||||
@@ -687,6 +687,7 @@ TitledBorder.border = 1,1,1,1,$Separator.foreground
|
||||
|
||||
TitlePane.useWindowDecorations = true
|
||||
TitlePane.menuBarEmbedded = true
|
||||
TitlePane.unifiedBackground = false
|
||||
TitlePane.iconSize = 16,16
|
||||
TitlePane.iconMargins = 3,8,3,8
|
||||
TitlePane.titleMargins = 3,0,3,0
|
||||
|
||||
@@ -170,6 +170,11 @@ class DemoFrame
|
||||
// repaint();
|
||||
}
|
||||
|
||||
private void unifiedTitleBar() {
|
||||
UIManager.put( "TitlePane.unifiedBackground", unifiedTitleBarMenuItem.isSelected() );
|
||||
FlatLaf.updateUI();
|
||||
}
|
||||
|
||||
private void underlineMenuSelection() {
|
||||
UIManager.put( "MenuItem.selectionType", underlineMenuSelectionMenuItem.isSelected() ? "underline" : null );
|
||||
}
|
||||
@@ -334,6 +339,7 @@ class DemoFrame
|
||||
optionsMenu = new JMenu();
|
||||
windowDecorationsCheckBoxMenuItem = new JCheckBoxMenuItem();
|
||||
menuBarEmbeddedCheckBoxMenuItem = new JCheckBoxMenuItem();
|
||||
unifiedTitleBarMenuItem = new JCheckBoxMenuItem();
|
||||
underlineMenuSelectionMenuItem = new JCheckBoxMenuItem();
|
||||
alwaysShowMnemonicsMenuItem = new JCheckBoxMenuItem();
|
||||
animatedLafChangeMenuItem = new JCheckBoxMenuItem();
|
||||
@@ -595,6 +601,11 @@ class DemoFrame
|
||||
menuBarEmbeddedCheckBoxMenuItem.addActionListener(e -> menuBarEmbeddedChanged());
|
||||
optionsMenu.add(menuBarEmbeddedCheckBoxMenuItem);
|
||||
|
||||
//---- unifiedTitleBarMenuItem ----
|
||||
unifiedTitleBarMenuItem.setText("Unified Title Bar");
|
||||
unifiedTitleBarMenuItem.addActionListener(e -> unifiedTitleBar());
|
||||
optionsMenu.add(unifiedTitleBarMenuItem);
|
||||
|
||||
//---- underlineMenuSelectionMenuItem ----
|
||||
underlineMenuSelectionMenuItem.setText("Use underline menu selection");
|
||||
underlineMenuSelectionMenuItem.addActionListener(e -> underlineMenuSelection());
|
||||
@@ -760,6 +771,7 @@ class DemoFrame
|
||||
private JMenu optionsMenu;
|
||||
private JCheckBoxMenuItem windowDecorationsCheckBoxMenuItem;
|
||||
private JCheckBoxMenuItem menuBarEmbeddedCheckBoxMenuItem;
|
||||
private JCheckBoxMenuItem unifiedTitleBarMenuItem;
|
||||
private JCheckBoxMenuItem underlineMenuSelectionMenuItem;
|
||||
private JCheckBoxMenuItem alwaysShowMnemonicsMenuItem;
|
||||
private JCheckBoxMenuItem animatedLafChangeMenuItem;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -360,6 +360,14 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuBarEmbeddedChanged", false ) )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "unifiedTitleBarMenuItem"
|
||||
"text": "Unified Title Bar"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "unifiedTitleBar", false ) )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "underlineMenuSelectionMenuItem"
|
||||
"text": "Use underline menu selection"
|
||||
|
||||
@@ -1145,6 +1145,7 @@ TitlePane.menuBarEmbedded true
|
||||
TitlePane.menuBarTitleGap 20
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
@@ -1150,6 +1150,7 @@ TitlePane.menuBarEmbedded true
|
||||
TitlePane.menuBarTitleGap 20
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
@@ -1142,6 +1142,7 @@ TitlePane.menuBarEmbedded true
|
||||
TitlePane.menuBarTitleGap 20
|
||||
TitlePane.restoreIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowRestoreIcon [UI]
|
||||
TitlePane.titleMargins 3,0,3,0 javax.swing.plaf.InsetsUIResource [UI]
|
||||
TitlePane.unifiedBackground false
|
||||
TitlePane.useWindowDecorations true
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -109,6 +110,11 @@ public class FlatWindowDecorationsTest
|
||||
}
|
||||
}
|
||||
|
||||
private void unifiedBackgroundChanged() {
|
||||
UIManager.put( "TitlePane.unifiedBackground", unifiedBackgroundCheckBox.isSelected() );
|
||||
FlatLaf.updateUI();
|
||||
}
|
||||
|
||||
private void menuBarChanged() {
|
||||
Window window = SwingUtilities.windowForComponent( this );
|
||||
if( window instanceof JFrame ) {
|
||||
@@ -306,18 +312,19 @@ public class FlatWindowDecorationsTest
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
menuBarCheckBox = new JCheckBox();
|
||||
unifiedBackgroundCheckBox = new JCheckBox();
|
||||
JPanel panel3 = new JPanel();
|
||||
addMenuButton = new JButton();
|
||||
JButton addGlueButton = new JButton();
|
||||
removeMenuButton = new JButton();
|
||||
changeMenuButton = new JButton();
|
||||
JButton changeTitleButton = new JButton();
|
||||
menuBarEmbeddedCheckBox = new JCheckBox();
|
||||
menuBarVisibleCheckBox = new JCheckBox();
|
||||
colorizeMenuBarCheckBox = new JCheckBox();
|
||||
menuBarVisibleCheckBox = new JCheckBox();
|
||||
colorizeMenusCheckBox = new JCheckBox();
|
||||
resizableCheckBox = new JCheckBox();
|
||||
maximizedBoundsCheckBox = new JCheckBox();
|
||||
JPanel hSpacer1 = new JPanel(null);
|
||||
JButton changeTitleButton = new JButton();
|
||||
undecoratedCheckBox = new JCheckBox();
|
||||
fullScreenCheckBox = new JCheckBox();
|
||||
JLabel label1 = new JLabel();
|
||||
@@ -369,7 +376,8 @@ public class FlatWindowDecorationsTest
|
||||
"ltr,insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[left]para" +
|
||||
"[left]",
|
||||
"[left]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"para[]0" +
|
||||
"[]0" +
|
||||
@@ -386,25 +394,50 @@ public class FlatWindowDecorationsTest
|
||||
menuBarCheckBox.addActionListener(e -> menuBarChanged());
|
||||
add(menuBarCheckBox, "cell 0 0");
|
||||
|
||||
//---- addMenuButton ----
|
||||
addMenuButton.setText("Add menu");
|
||||
addMenuButton.addActionListener(e -> addMenu());
|
||||
add(addMenuButton, "cell 1 0 1 2,align left top,grow 0 0");
|
||||
//---- unifiedBackgroundCheckBox ----
|
||||
unifiedBackgroundCheckBox.setText("unified background");
|
||||
unifiedBackgroundCheckBox.addActionListener(e -> unifiedBackgroundChanged());
|
||||
add(unifiedBackgroundCheckBox, "cell 1 0");
|
||||
|
||||
//---- addGlueButton ----
|
||||
addGlueButton.setText("Add glue");
|
||||
addGlueButton.addActionListener(e -> addGlue());
|
||||
add(addGlueButton, "cell 1 0 1 2,align left top,grow 0 0");
|
||||
//======== panel3 ========
|
||||
{
|
||||
panel3.setLayout(new MigLayout(
|
||||
"hidemode 3",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]unrel" +
|
||||
"[]"));
|
||||
|
||||
//---- removeMenuButton ----
|
||||
removeMenuButton.setText("Remove menu");
|
||||
removeMenuButton.addActionListener(e -> removeMenu());
|
||||
add(removeMenuButton, "cell 1 0 1 2,align left top,grow 0 0");
|
||||
//---- addMenuButton ----
|
||||
addMenuButton.setText("Add menu");
|
||||
addMenuButton.addActionListener(e -> addMenu());
|
||||
panel3.add(addMenuButton, "cell 0 0");
|
||||
|
||||
//---- changeMenuButton ----
|
||||
changeMenuButton.setText("Change menu");
|
||||
changeMenuButton.addActionListener(e -> changeMenu());
|
||||
add(changeMenuButton, "cell 1 0 1 2,align left top,grow 0 0");
|
||||
//---- addGlueButton ----
|
||||
addGlueButton.setText("Add glue");
|
||||
addGlueButton.addActionListener(e -> addGlue());
|
||||
panel3.add(addGlueButton, "cell 0 1");
|
||||
|
||||
//---- removeMenuButton ----
|
||||
removeMenuButton.setText("Remove menu");
|
||||
removeMenuButton.addActionListener(e -> removeMenu());
|
||||
panel3.add(removeMenuButton, "cell 0 2");
|
||||
|
||||
//---- changeMenuButton ----
|
||||
changeMenuButton.setText("Change menu");
|
||||
changeMenuButton.addActionListener(e -> changeMenu());
|
||||
panel3.add(changeMenuButton, "cell 0 3");
|
||||
|
||||
//---- changeTitleButton ----
|
||||
changeTitleButton.setText("Change title");
|
||||
changeTitleButton.addActionListener(e -> changeTitle());
|
||||
panel3.add(changeTitleButton, "cell 0 4");
|
||||
}
|
||||
add(panel3, "cell 2 0 1 6,aligny top,growy 0");
|
||||
|
||||
//---- menuBarEmbeddedCheckBox ----
|
||||
menuBarEmbeddedCheckBox.setText("embedded menu bar");
|
||||
@@ -412,17 +445,17 @@ public class FlatWindowDecorationsTest
|
||||
menuBarEmbeddedCheckBox.addActionListener(e -> menuBarEmbeddedChanged());
|
||||
add(menuBarEmbeddedCheckBox, "cell 0 1");
|
||||
|
||||
//---- colorizeMenuBarCheckBox ----
|
||||
colorizeMenuBarCheckBox.setText("colorize menu bar");
|
||||
colorizeMenuBarCheckBox.addActionListener(e -> colorizeMenuBar());
|
||||
add(colorizeMenuBarCheckBox, "cell 1 1");
|
||||
|
||||
//---- menuBarVisibleCheckBox ----
|
||||
menuBarVisibleCheckBox.setText("menu bar visible");
|
||||
menuBarVisibleCheckBox.setSelected(true);
|
||||
menuBarVisibleCheckBox.addActionListener(e -> menuBarVisibleChanged());
|
||||
add(menuBarVisibleCheckBox, "cell 0 2");
|
||||
|
||||
//---- colorizeMenuBarCheckBox ----
|
||||
colorizeMenuBarCheckBox.setText("colorize menu bar");
|
||||
colorizeMenuBarCheckBox.addActionListener(e -> colorizeMenuBar());
|
||||
add(colorizeMenuBarCheckBox, "cell 1 2");
|
||||
|
||||
//---- colorizeMenusCheckBox ----
|
||||
colorizeMenusCheckBox.setText("colorize menus");
|
||||
colorizeMenusCheckBox.addActionListener(e -> colorizeMenus());
|
||||
@@ -438,12 +471,6 @@ public class FlatWindowDecorationsTest
|
||||
maximizedBoundsCheckBox.setText("maximized bounds (50,100, 1000,700)");
|
||||
maximizedBoundsCheckBox.addActionListener(e -> maximizedBoundsChanged());
|
||||
add(maximizedBoundsCheckBox, "cell 1 3");
|
||||
add(hSpacer1, "cell 1 3,growx");
|
||||
|
||||
//---- changeTitleButton ----
|
||||
changeTitleButton.setText("Change title");
|
||||
changeTitleButton.addActionListener(e -> changeTitle());
|
||||
add(changeTitleButton, "cell 1 3");
|
||||
|
||||
//---- undecoratedCheckBox ----
|
||||
undecoratedCheckBox.setText("undecorated");
|
||||
@@ -752,12 +779,13 @@ public class FlatWindowDecorationsTest
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JCheckBox menuBarCheckBox;
|
||||
private JCheckBox unifiedBackgroundCheckBox;
|
||||
private JButton addMenuButton;
|
||||
private JButton removeMenuButton;
|
||||
private JButton changeMenuButton;
|
||||
private JCheckBox menuBarEmbeddedCheckBox;
|
||||
private JCheckBox menuBarVisibleCheckBox;
|
||||
private JCheckBox colorizeMenuBarCheckBox;
|
||||
private JCheckBox menuBarVisibleCheckBox;
|
||||
private JCheckBox colorizeMenusCheckBox;
|
||||
private JCheckBox resizableCheckBox;
|
||||
private JCheckBox maximizedBoundsCheckBox;
|
||||
|
||||
@@ -8,7 +8,7 @@ new FormModel {
|
||||
}
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[left]para[left]"
|
||||
"$columnConstraints": "[left]para[left][fill]"
|
||||
"$rowConstraints": "para[]0[]0[]unrel[]0[]unrel[][top][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
@@ -23,42 +23,68 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "addMenuButton"
|
||||
"text": "Add menu"
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "unifiedBackgroundCheckBox"
|
||||
"text": "unified background"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "addMenu", false ) )
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "unifiedBackgroundChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 1 2,align left top,grow 0 0"
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "addGlueButton"
|
||||
"text": "Add glue"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "addGlue", false ) )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][][][]unrel[]"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "addMenuButton"
|
||||
"text": "Add menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "addMenu", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "addGlueButton"
|
||||
"text": "Add glue"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "addGlue", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "removeMenuButton"
|
||||
"text": "Remove menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "removeMenu", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "changeMenuButton"
|
||||
"text": "Change menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "changeMenu", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "changeTitleButton"
|
||||
"text": "Change title"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "changeTitle", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 1 2,align left top,grow 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "removeMenuButton"
|
||||
"text": "Remove menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "removeMenu", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 1 2,align left top,grow 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "changeMenuButton"
|
||||
"text": "Change menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "changeMenu", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 1 2,align left top,grow 0 0"
|
||||
"value": "cell 2 0 1 6,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "menuBarEmbeddedCheckBox"
|
||||
@@ -71,6 +97,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "colorizeMenuBarCheckBox"
|
||||
"text": "colorize menu bar"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "colorizeMenuBar", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "menuBarVisibleCheckBox"
|
||||
"text": "menu bar visible"
|
||||
@@ -82,16 +118,6 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "colorizeMenuBarCheckBox"
|
||||
"text": "colorize menu bar"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "colorizeMenuBar", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "colorizeMenusCheckBox"
|
||||
"text": "colorize menus"
|
||||
@@ -123,18 +149,6 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||
name: "hSpacer1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "changeTitleButton"
|
||||
"text": "Change title"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "changeTitle", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "undecoratedCheckBox"
|
||||
"text": "undecorated"
|
||||
@@ -328,7 +342,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 580, 440 )
|
||||
"size": new java.awt.Dimension( 690, 440 )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
|
||||
name: "menuBar"
|
||||
|
||||
@@ -855,6 +855,7 @@ TitlePane.menuBarEmbedded
|
||||
TitlePane.menuBarTitleGap
|
||||
TitlePane.restoreIcon
|
||||
TitlePane.titleMargins
|
||||
TitlePane.unifiedBackground
|
||||
TitlePane.useWindowDecorations
|
||||
TitledBorder.border
|
||||
TitledBorder.font
|
||||
|
||||
Reference in New Issue
Block a user