From 99be34638771161fdf5ec55ac29d8f2a744586f5 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 17 Sep 2020 13:28:02 +0200 Subject: [PATCH] FlatWindowDecorationsTest: disable "add/remove/change menu" buttons if shown in dialog, which does not have a menubar --- .../flatlaf/testing/FlatWindowDecorationsTest.java | 13 ++++++++++--- .../flatlaf/testing/FlatWindowDecorationsTest.jfd | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java index dc139882..59587202 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java @@ -78,6 +78,10 @@ public class FlatWindowDecorationsTest menuBarEmbeddedCheckBox.setEnabled( window instanceof JFrame ); maximizedBoundsCheckBox.setEnabled( window instanceof Frame ); + addMenuButton.setEnabled( menuBarCheckBox.isEnabled() ); + removeMenuButton.setEnabled( menuBarCheckBox.isEnabled() ); + changeMenuButton.setEnabled( menuBarCheckBox.isEnabled() ); + boolean windowHasIcons = (window != null && !window.getIconImages().isEmpty()); iconNoneRadioButton.setEnabled( windowHasIcons ); iconTestAllRadioButton.setEnabled( windowHasIcons ); @@ -246,9 +250,9 @@ public class FlatWindowDecorationsTest private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents menuBarCheckBox = new JCheckBox(); - JButton addMenuButton = new JButton(); - JButton removeMenuButton = new JButton(); - JButton changeMenuButton = new JButton(); + addMenuButton = new JButton(); + removeMenuButton = new JButton(); + changeMenuButton = new JButton(); menuBarEmbeddedCheckBox = new JCheckBox(); resizableCheckBox = new JCheckBox(); maximizedBoundsCheckBox = new JCheckBox(); @@ -652,6 +656,9 @@ public class FlatWindowDecorationsTest // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JCheckBox menuBarCheckBox; + private JButton addMenuButton; + private JButton removeMenuButton; + private JButton changeMenuButton; private JCheckBox menuBarEmbeddedCheckBox; private JCheckBox resizableCheckBox; private JCheckBox maximizedBoundsCheckBox; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.jfd index 378f3e31..72092968 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.jfd @@ -26,6 +26,9 @@ new FormModel { 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 1 0 1 2,align left top,grow 0 0" @@ -33,6 +36,9 @@ new FormModel { 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" @@ -40,6 +46,9 @@ new FormModel { 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"