diff --git a/CHANGELOG.md b/CHANGELOG.md index 832c6952..d2f988b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,11 @@ FlatLaf Change Log 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 - `JRootPane.titleBarShowIcon` to `false`; for all windows set UI value - `TitlePane.showIcon` to `false`). + - Possibility to hide window title bar icon (for single window set client + property `JRootPane.titleBarShowIcon` to `false`; for all windows set UI + value `TitlePane.showIcon` to `false`). + - OptionPane: Hide window title bar icon by default. Can be be made visibly by + setting UI default `OptionPane.showIcon` to `true`. (issue #416) - No longer show the Java "duke/cup" icon if no window icon image is set. (issue #416) - TextField, FormattedTextField and PasswordField: Support leading and trailing diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatOptionPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatOptionPaneUI.java index d0413691..ae36668f 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatOptionPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatOptionPaneUI.java @@ -22,18 +22,22 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.Insets; +import java.beans.PropertyChangeListener; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicHTML; import javax.swing.plaf.basic.BasicOptionPaneUI; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.util.UIScale; /** @@ -79,6 +83,7 @@ import com.formdev.flatlaf.util.UIScale; * * * + * @uiDefault OptionPane.showIcon boolean * @uiDefault OptionPane.iconMessageGap int * @uiDefault OptionPane.messagePadding int * @uiDefault OptionPane.maxCharactersPerLine int @@ -88,6 +93,7 @@ import com.formdev.flatlaf.util.UIScale; public class FlatOptionPaneUI extends BasicOptionPaneUI { + /** @since 2 */ protected boolean showIcon; protected int iconMessageGap; protected int messagePadding; protected int maxCharactersPerLine; @@ -102,6 +108,7 @@ public class FlatOptionPaneUI protected void installDefaults() { super.installDefaults(); + showIcon = UIManager.getBoolean( "OptionPane.showIcon" ); iconMessageGap = UIManager.getInt( "OptionPane.iconMessageGap" ); messagePadding = UIManager.getInt( "OptionPane.messagePadding" ); maxCharactersPerLine = UIManager.getInt( "OptionPane.maxCharactersPerLine" ); @@ -116,6 +123,24 @@ public class FlatOptionPaneUI updateChildPanels( optionPane ); } + @Override + protected PropertyChangeListener createPropertyChangeListener() { + PropertyChangeListener superListener = super.createPropertyChangeListener(); + return e -> { + superListener.propertyChange( e ); + + // hide window title bar icon + // (only if showIcon is false, otherwise the default behavior is used) + if( !showIcon && "ancestor".equals( e.getPropertyName() ) && e.getNewValue() != null ) { + JRootPane rootPane = SwingUtilities.getRootPane( optionPane ); + if( rootPane != null && + rootPane.getContentPane().getComponentCount() > 0 && + rootPane.getContentPane().getComponent( 0 ) == optionPane ) + rootPane.putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_ICON, false ); + } + }; + } + @Override public Dimension getMinimumOptionPaneSize() { return UIScale.scale( super.getMinimumOptionPaneSize() ); diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 893cdf96..0ec8bba3 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -394,6 +394,7 @@ OptionPane.messageAreaBorder = 0,0,0,0 OptionPane.buttonAreaBorder = 12,0,0,0 OptionPane.messageForeground = null +OptionPane.showIcon = false OptionPane.maxCharactersPerLine = 80 OptionPane.iconMessageGap = 16 OptionPane.messagePadding = 3 diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java index 98de9d00..d1622644 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java @@ -21,6 +21,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.*; import javax.swing.border.*; +import com.formdev.flatlaf.FlatLaf; import net.miginfocom.swing.*; /** @@ -44,6 +45,29 @@ class OptionPanePanel "OK", "Cancel", } ); + + if( FlatLaf.supportsNativeWindowDecorations() ) { + updateShowTitleBarIcon(); + + UIManager.getDefaults().addPropertyChangeListener( e -> { + switch( e.getPropertyName() ) { + case "TitlePane.showIcon": + case "TitlePane.useWindowDecorations": + updateShowTitleBarIcon(); + break; + } + } ); + } else + showTitleBarIconCheckBox.setEnabled( false ); + } + + private void updateShowTitleBarIcon() { + showTitleBarIconCheckBox.setEnabled( UIManager.getBoolean( "TitlePane.showIcon" ) && + FlatLaf.isUseNativeWindowDecorations() ); + } + + private void showTitleBarIcon() { + UIManager.put( "OptionPane.showIcon", showTitleBarIconCheckBox.isSelected() ); } private void initComponents() { @@ -54,6 +78,7 @@ class OptionPanePanel JPanel panel1 = new JPanel(); JOptionPane plainOptionPane = new JOptionPane(); plainShowDialogLabel = new OptionPanePanel.ShowDialogLinkLabel(); + showTitleBarIconCheckBox = new JCheckBox(); JLabel errorLabel = new JLabel(); JPanel panel2 = new JPanel(); JOptionPane errorOptionPane = new JOptionPane(); @@ -93,7 +118,7 @@ class OptionPanePanel //======== panel9 ======== { panel9.setLayout(new MigLayout( - "flowy,insets dialog,hidemode 3", + "insets dialog,hidemode 3", // columns "[]" + "[]" + @@ -126,7 +151,12 @@ class OptionPanePanel //---- plainShowDialogLabel ---- plainShowDialogLabel.setOptionPane(plainOptionPane); plainShowDialogLabel.setTitleLabel(plainLabel); - panel9.add(plainShowDialogLabel, "cell 2 0"); + panel9.add(plainShowDialogLabel, "cell 1 0"); + + //---- showTitleBarIconCheckBox ---- + showTitleBarIconCheckBox.setText("Show window title bar icon"); + showTitleBarIconCheckBox.addActionListener(e -> showTitleBarIcon()); + panel9.add(showTitleBarIconCheckBox, "cell 2 0"); //---- errorLabel ---- errorLabel.setText("Error"); @@ -148,7 +178,7 @@ class OptionPanePanel //---- errorShowDialogLabel ---- errorShowDialogLabel.setTitleLabel(errorLabel); errorShowDialogLabel.setOptionPane(errorOptionPane); - panel9.add(errorShowDialogLabel, "cell 2 1"); + panel9.add(errorShowDialogLabel, "cell 1 1"); //---- informationLabel ---- informationLabel.setText("Information"); @@ -170,7 +200,7 @@ class OptionPanePanel //---- informationShowDialogLabel ---- informationShowDialogLabel.setOptionPane(informationOptionPane); informationShowDialogLabel.setTitleLabel(informationLabel); - panel9.add(informationShowDialogLabel, "cell 2 2"); + panel9.add(informationShowDialogLabel, "cell 1 2"); //---- questionLabel ---- questionLabel.setText("Question"); @@ -214,7 +244,7 @@ class OptionPanePanel //---- warningShowDialogLabel ---- warningShowDialogLabel.setOptionPane(warningOptionPane); warningShowDialogLabel.setTitleLabel(warningLabel); - panel9.add(warningShowDialogLabel, "cell 2 4"); + panel9.add(warningShowDialogLabel, "cell 1 4"); //---- inputLabel ---- inputLabel.setText("Input"); @@ -236,7 +266,7 @@ class OptionPanePanel //---- inputShowDialogLabel ---- inputShowDialogLabel.setOptionPane(inputOptionPane); inputShowDialogLabel.setTitleLabel(inputLabel); - panel9.add(inputShowDialogLabel, "cell 2 5"); + panel9.add(inputShowDialogLabel, "cell 1 5"); //---- inputIconLabel ---- inputIconLabel.setText("Input + icon"); @@ -259,7 +289,7 @@ class OptionPanePanel //---- inputIconShowDialogLabel ---- inputIconShowDialogLabel.setTitleLabel(inputIconLabel); inputIconShowDialogLabel.setOptionPane(inputIconOptionPane); - panel9.add(inputIconShowDialogLabel, "cell 2 6"); + panel9.add(inputIconShowDialogLabel, "cell 1 6"); //---- customLabel ---- customLabel.setText("Custom"); @@ -279,7 +309,7 @@ class OptionPanePanel //---- customShowDialogLabel ---- customShowDialogLabel.setOptionPane(customOptionPane); customShowDialogLabel.setTitleLabel(customLabel); - panel9.add(customShowDialogLabel, "cell 2 7"); + panel9.add(customShowDialogLabel, "cell 1 7"); } scrollPane1.setViewportView(panel9); } @@ -289,6 +319,7 @@ class OptionPanePanel // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private OptionPanePanel.ShowDialogLinkLabel plainShowDialogLabel; + private JCheckBox showTitleBarIconCheckBox; private OptionPanePanel.ShowDialogLinkLabel errorShowDialogLabel; private OptionPanePanel.ShowDialogLinkLabel informationShowDialogLabel; private JOptionPane customOptionPane; @@ -304,6 +335,7 @@ class OptionPanePanel ShowDialogLinkLabel() { setText( "Show dialog" ); + setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); addMouseListener( new MouseAdapter() { @Override diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.jfd index 23905510..7d58e157 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.jfd @@ -12,7 +12,7 @@ new FormModel { name: "scrollPane1" "border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 ) add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { - "$layoutConstraints": "flowy,insets dialog,hidemode 3" + "$layoutConstraints": "insets dialog,hidemode 3" "$columnConstraints": "[][][fill]" "$rowConstraints": "[top][top][top][top][top][top][top][top]" } ) { @@ -42,6 +42,16 @@ new FormModel { auxiliary() { "JavaCodeGenerator.variableLocal": false } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "showTitleBarIconCheckBox" + "text": "Show window title bar icon" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTitleBarIcon", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0" } ) @@ -73,7 +83,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 1" + "value": "cell 1 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "informationLabel" @@ -103,7 +113,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 2" + "value": "cell 1 2" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "questionLabel" @@ -157,7 +167,7 @@ new FormModel { "optionPane": new FormReference( "warningOptionPane" ) "titleLabel": new FormReference( "warningLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 4" + "value": "cell 1 4" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "inputLabel" @@ -184,7 +194,7 @@ new FormModel { "optionPane": new FormReference( "inputOptionPane" ) "titleLabel": new FormReference( "inputLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 5" + "value": "cell 1 5" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "inputIconLabel" @@ -212,7 +222,7 @@ new FormModel { "titleLabel": new FormReference( "inputIconLabel" ) "optionPane": new FormReference( "inputIconOptionPane" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 6" + "value": "cell 1 6" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "customLabel" @@ -240,7 +250,7 @@ new FormModel { "optionPane": new FormReference( "customOptionPane" ) "titleLabel": new FormReference( "customLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 7" + "value": "cell 1 7" } ) } ) }, new FormLayoutConstraints( class java.lang.String ) { @@ -248,7 +258,7 @@ new FormModel { } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 840, 900 ) + "size": new java.awt.Dimension( 955, 900 ) } ) } } diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt index 17e9a34d..49426eff 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt @@ -671,6 +671,7 @@ OptionPane.minimumSize 262,90 javax.swing.plaf.DimensionUIResource [U OptionPane.questionIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneQuestionIcon [UI] OptionPane.sameSizeButtons true OptionPane.setButtonMargin false +OptionPane.showIcon false OptionPane.warningIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneWarningIcon [UI] OptionPane.windowBindings length=2 [Ljava.lang.Object; [0] ESCAPE diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt index 9a5d461b..8b86a8f6 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt @@ -676,6 +676,7 @@ OptionPane.minimumSize 262,90 javax.swing.plaf.DimensionUIResource [U OptionPane.questionIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneQuestionIcon [UI] OptionPane.sameSizeButtons true OptionPane.setButtonMargin false +OptionPane.showIcon false OptionPane.warningIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneWarningIcon [UI] OptionPane.windowBindings length=2 [Ljava.lang.Object; [0] ESCAPE diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt index 3e8490fd..a6560310 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt @@ -687,6 +687,7 @@ OptionPane.minimumSize 262,90 javax.swing.plaf.DimensionUIResource [U OptionPane.questionIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneQuestionIcon [UI] OptionPane.sameSizeButtons true OptionPane.setButtonMargin false +OptionPane.showIcon false OptionPane.warningIcon [lazy] 32,32 com.formdev.flatlaf.icons.FlatOptionPaneWarningIcon [UI] OptionPane.windowBindings length=2 [Ljava.lang.Object; [0] ESCAPE diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java index 3c3cda88..4a832fcf 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java @@ -33,6 +33,7 @@ public class FlatOptionPaneTest public static void main( String[] args ) { SwingUtilities.invokeLater( () -> { FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" ); + frame.setIconImage( new ImageIcon( FlatOptionPaneTest.class.getResource( "/com/formdev/flatlaf/testing/test16.png" ) ).getImage() ); frame.showFrame( FlatOptionPaneTest::new ); } ); } @@ -54,6 +55,10 @@ public class FlatOptionPaneTest } ); } + private void showTitleBarIcon() { + UIManager.put( "OptionPane.showIcon", showTitleBarIconCheckBox.isSelected() ); + } + private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents ScrollablePanel panel9 = new ScrollablePanel(); @@ -61,6 +66,7 @@ public class FlatOptionPaneTest JPanel panel1 = new JPanel(); JOptionPane plainOptionPane = new JOptionPane(); plainShowDialogLabel = new FlatOptionPaneTest.ShowDialogLinkLabel(); + showTitleBarIconCheckBox = new JCheckBox(); JLabel errorLabel = new JLabel(); JPanel panel2 = new JPanel(); JOptionPane errorOptionPane = new JOptionPane(); @@ -100,7 +106,7 @@ public class FlatOptionPaneTest //======== panel9 ======== { panel9.setLayout(new MigLayout( - "flowy,ltr,insets dialog,hidemode 3", + "ltr,insets dialog,hidemode 3", // columns "[]" + "[]" + @@ -134,7 +140,12 @@ public class FlatOptionPaneTest //---- plainShowDialogLabel ---- plainShowDialogLabel.setOptionPane(plainOptionPane); plainShowDialogLabel.setTitleLabel(plainLabel); - panel9.add(plainShowDialogLabel, "cell 2 0"); + panel9.add(plainShowDialogLabel, "cell 1 0"); + + //---- showTitleBarIconCheckBox ---- + showTitleBarIconCheckBox.setText("Show window title bar icon"); + showTitleBarIconCheckBox.addActionListener(e -> showTitleBarIcon()); + panel9.add(showTitleBarIconCheckBox, "cell 2 0"); //---- errorLabel ---- errorLabel.setText("Error"); @@ -156,7 +167,7 @@ public class FlatOptionPaneTest //---- errorShowDialogLabel ---- errorShowDialogLabel.setTitleLabel(errorLabel); errorShowDialogLabel.setOptionPane(errorOptionPane); - panel9.add(errorShowDialogLabel, "cell 2 1"); + panel9.add(errorShowDialogLabel, "cell 1 1"); //---- informationLabel ---- informationLabel.setText("Information"); @@ -178,7 +189,7 @@ public class FlatOptionPaneTest //---- informationShowDialogLabel ---- informationShowDialogLabel.setOptionPane(informationOptionPane); informationShowDialogLabel.setTitleLabel(informationLabel); - panel9.add(informationShowDialogLabel, "cell 2 2"); + panel9.add(informationShowDialogLabel, "cell 1 2"); //---- questionLabel ---- questionLabel.setText("Question"); @@ -222,7 +233,7 @@ public class FlatOptionPaneTest //---- warningShowDialogLabel ---- warningShowDialogLabel.setOptionPane(warningOptionPane); warningShowDialogLabel.setTitleLabel(warningLabel); - panel9.add(warningShowDialogLabel, "cell 2 4"); + panel9.add(warningShowDialogLabel, "cell 1 4"); //---- inputLabel ---- inputLabel.setText("Input"); @@ -244,7 +255,7 @@ public class FlatOptionPaneTest //---- inputShowDialogLabel ---- inputShowDialogLabel.setOptionPane(inputOptionPane); inputShowDialogLabel.setTitleLabel(inputLabel); - panel9.add(inputShowDialogLabel, "cell 2 5"); + panel9.add(inputShowDialogLabel, "cell 1 5"); //---- inputIconLabel ---- inputIconLabel.setText("Input + icon"); @@ -267,7 +278,7 @@ public class FlatOptionPaneTest //---- inputIconShowDialogLabel ---- inputIconShowDialogLabel.setTitleLabel(inputIconLabel); inputIconShowDialogLabel.setOptionPane(inputIconOptionPane); - panel9.add(inputIconShowDialogLabel, "cell 2 6"); + panel9.add(inputIconShowDialogLabel, "cell 1 6"); //---- customLabel ---- customLabel.setText("Custom"); @@ -287,7 +298,7 @@ public class FlatOptionPaneTest //---- customShowDialogLabel ---- customShowDialogLabel.setOptionPane(customOptionPane); customShowDialogLabel.setTitleLabel(customLabel); - panel9.add(customShowDialogLabel, "cell 2 7"); + panel9.add(customShowDialogLabel, "cell 1 7"); //---- rightToLeftLabel ---- rightToLeftLabel.setText("Right-to-left:"); @@ -317,6 +328,7 @@ public class FlatOptionPaneTest // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private FlatOptionPaneTest.ShowDialogLinkLabel plainShowDialogLabel; + private JCheckBox showTitleBarIconCheckBox; private FlatOptionPaneTest.ShowDialogLinkLabel errorShowDialogLabel; private FlatOptionPaneTest.ShowDialogLinkLabel informationShowDialogLabel; private JOptionPane customOptionPane; @@ -333,6 +345,7 @@ public class FlatOptionPaneTest ShowDialogLinkLabel() { setText( "Show dialog" ); + setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); addMouseListener( new MouseAdapter() { @Override diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.jfd index 78d9bf17..26deae19 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.jfd @@ -10,7 +10,7 @@ new FormModel { name: "this" "border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 ) add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { - "$layoutConstraints": "flowy,ltr,insets dialog,hidemode 3" + "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[][][fill]" "$rowConstraints": "[top][top][top][top][top][top][top][top][top]" } ) { @@ -40,6 +40,16 @@ new FormModel { auxiliary() { "JavaCodeGenerator.variableLocal": false } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "showTitleBarIconCheckBox" + "text": "Show window title bar icon" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTitleBarIcon", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0" } ) @@ -71,7 +81,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 1" + "value": "cell 1 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "informationLabel" @@ -101,7 +111,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 2" + "value": "cell 1 2" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "questionLabel" @@ -155,7 +165,7 @@ new FormModel { "optionPane": new FormReference( "warningOptionPane" ) "titleLabel": new FormReference( "warningLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 4" + "value": "cell 1 4" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "inputLabel" @@ -182,7 +192,7 @@ new FormModel { "optionPane": new FormReference( "inputOptionPane" ) "titleLabel": new FormReference( "inputLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 5" + "value": "cell 1 5" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "inputIconLabel" @@ -210,7 +220,7 @@ new FormModel { "titleLabel": new FormReference( "inputIconLabel" ) "optionPane": new FormReference( "inputIconOptionPane" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 6" + "value": "cell 1 6" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "customLabel" @@ -238,7 +248,7 @@ new FormModel { "optionPane": new FormReference( "customOptionPane" ) "titleLabel": new FormReference( "customLabel" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 7" + "value": "cell 1 7" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "rightToLeftLabel" @@ -273,7 +283,7 @@ new FormModel { } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 895, 1080 ) + "size": new java.awt.Dimension( 995, 1080 ) } ) } } diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index c2b5297f..d8e617bc 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -531,6 +531,7 @@ OptionPane.minimumSize OptionPane.questionIcon OptionPane.sameSizeButtons OptionPane.setButtonMargin +OptionPane.showIcon OptionPane.warningIcon OptionPane.windowBindings OptionPaneUI