mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 14:37:13 -06:00
Menus: fixed icon in top-level JMenu (issue #3)
This commit is contained in:
@@ -31,6 +31,7 @@ public class FlatMenusTest
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
||||
frame.useApplyComponentOrientation = true;
|
||||
frame.showFrame( FlatMenusTest::new );
|
||||
} );
|
||||
}
|
||||
@@ -68,6 +69,10 @@ public class FlatMenusTest
|
||||
JMenu menu5 = new JMenu();
|
||||
JMenuItem menuItem7 = new JMenuItem();
|
||||
JMenuItem menuItem8 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem7 = new JRadioButtonMenuItem();
|
||||
JMenu menu6 = new JMenu();
|
||||
JMenuItem menuItem5 = new JMenuItem();
|
||||
JMenuItem menuItem6 = new JMenuItem();
|
||||
@@ -127,16 +132,37 @@ public class FlatMenusTest
|
||||
{
|
||||
menu5.setText("text");
|
||||
menu5.setMnemonic('T');
|
||||
menu5.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
||||
|
||||
//---- menuItem7 ----
|
||||
menuItem7.setText("text");
|
||||
menuItem7.setMnemonic('X');
|
||||
menuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
||||
menu5.add(menuItem7);
|
||||
|
||||
//---- menuItem8 ----
|
||||
menuItem8.setText("text");
|
||||
menuItem8.setMnemonic('E');
|
||||
menuItem8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png")));
|
||||
menu5.add(menuItem8);
|
||||
|
||||
//---- checkBoxMenuItem6 ----
|
||||
checkBoxMenuItem6.setText("check");
|
||||
checkBoxMenuItem6.setSelected(true);
|
||||
menu5.add(checkBoxMenuItem6);
|
||||
|
||||
//---- radioButtonMenuItem5 ----
|
||||
radioButtonMenuItem5.setText("radio 1");
|
||||
radioButtonMenuItem5.setSelected(true);
|
||||
menu5.add(radioButtonMenuItem5);
|
||||
|
||||
//---- radioButtonMenuItem6 ----
|
||||
radioButtonMenuItem6.setText("radio 2");
|
||||
menu5.add(radioButtonMenuItem6);
|
||||
|
||||
//---- radioButtonMenuItem7 ----
|
||||
radioButtonMenuItem7.setText("radio 3");
|
||||
menu5.add(radioButtonMenuItem7);
|
||||
}
|
||||
menuBar1.add(menu5);
|
||||
|
||||
@@ -361,6 +387,12 @@ public class FlatMenusTest
|
||||
armedCheckBox.setMnemonic('A');
|
||||
armedCheckBox.addActionListener(e -> armedChanged());
|
||||
add(armedCheckBox, "cell 0 3");
|
||||
|
||||
//---- buttonGroup1 ----
|
||||
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||
buttonGroup1.add(radioButtonMenuItem5);
|
||||
buttonGroup1.add(radioButtonMenuItem6);
|
||||
buttonGroup1.add(radioButtonMenuItem7);
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -24,15 +24,39 @@ new FormModel {
|
||||
name: "menu5"
|
||||
"text": "text"
|
||||
"mnemonic": 84
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem7"
|
||||
"text": "text"
|
||||
"mnemonic": 88
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem8"
|
||||
"text": "text"
|
||||
"mnemonic": 69
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png" )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem6"
|
||||
"text": "check"
|
||||
"selected": true
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem5"
|
||||
"text": "radio 1"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
"selected": true
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem6"
|
||||
"text": "radio 2"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem7"
|
||||
"text": "radio 3"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
@@ -321,5 +345,10 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 430 )
|
||||
} )
|
||||
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
||||
name: "buttonGroup1"
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 564 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user