mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
MenuItem: use isArmedOrSelected() instead of MenuSelectionManager to detect selected item
This commit is contained in:
@@ -162,6 +162,9 @@ public class FlatMenusTest
|
||||
FlatMenusTest.MenuWithAccelerator menuWithAccelerator2 = new FlatMenusTest.MenuWithAccelerator();
|
||||
JMenuItem menuItem40 = new JMenuItem();
|
||||
JMenuItem menuItem39 = new JMenuItem();
|
||||
JMenu menu12 = new JMenu();
|
||||
JMenuItem menuItem41 = new JMenuItem();
|
||||
JMenuItem menuItem42 = new JMenuItem();
|
||||
menuBar2 = new JMenuBar();
|
||||
JMenu menu8 = new JMenu();
|
||||
FlatMenusTest.LargerMenuItem menuItem13 = new FlatMenusTest.LargerMenuItem();
|
||||
@@ -377,6 +380,25 @@ public class FlatMenusTest
|
||||
menuWithAccelerator1.add(menuItem39);
|
||||
}
|
||||
menuBar1.add(menuWithAccelerator1);
|
||||
|
||||
//======== menu12 ========
|
||||
{
|
||||
menu12.setText("icons");
|
||||
|
||||
//---- menuItem41 ----
|
||||
menuItem41.setText("selected icon");
|
||||
menuItem41.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png")));
|
||||
menuItem41.setSelectedIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show_dark.png")));
|
||||
menu12.add(menuItem41);
|
||||
|
||||
//---- menuItem42 ----
|
||||
menuItem42.setText("disabled icon");
|
||||
menuItem42.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png")));
|
||||
menuItem42.setDisabledIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
|
||||
menuItem42.setEnabled(false);
|
||||
menu12.add(menuItem42);
|
||||
}
|
||||
menuBar1.add(menu12);
|
||||
}
|
||||
add(menuBar1, "cell 1 0 2 1,growx");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.5.0.404" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -149,6 +149,23 @@ new FormModel {
|
||||
"accelerator": #KeyStroke0
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu12"
|
||||
"text": "icons"
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem41"
|
||||
"text": "selected icon"
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png" )
|
||||
"selectedIcon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show_dark.png" )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem42"
|
||||
"text": "disabled icon"
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png" )
|
||||
"disabledIcon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png" )
|
||||
"enabled": false
|
||||
} )
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 2 1,growx"
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user