Menus: on Windows, releasing Alt key now activates the menu bar (issue #43)

This commit is contained in:
Karl Tauber
2020-05-04 10:57:10 +02:00
parent 80981f7027
commit f014e2473f
4 changed files with 96 additions and 4 deletions

View File

@@ -56,6 +56,10 @@ public class FlatMnemonicsTest
SwingUtilities.windowForComponent( this ).repaint();
}
private void openDialog() {
JOptionPane.showMessageDialog( this, new FlatMnemonicsTest() );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel label1 = new JLabel();
@@ -77,6 +81,7 @@ public class FlatMnemonicsTest
JPanel panel3 = new JPanel();
JLabel label5 = new JLabel();
alwaysShowMnemonicsCheckBox = new JCheckBox();
JButton button2 = new JButton();
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu();
JMenuItem newMenuItem = new JMenuItem();
@@ -114,7 +119,7 @@ public class FlatMnemonicsTest
// columns
"[fill]" +
"[150,fill]para" +
"[grow,fill]",
"[300,grow,fill]",
// rows
"[]" +
"[]" +
@@ -238,6 +243,11 @@ public class FlatMnemonicsTest
alwaysShowMnemonicsCheckBox.addActionListener(e -> alwaysShowMnemonicsChanged());
add(alwaysShowMnemonicsCheckBox, "cell 0 7 2 1,alignx left,growx 0");
//---- button2 ----
button2.setText("Open Dialog");
button2.addActionListener(e -> openDialog());
add(button2, "cell 2 7,alignx left,growx 0");
//======== menuBar ========
{

View File

@@ -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": "[fill][150,fill]para[grow,fill]"
"$columnConstraints": "[fill][150,fill]para[300,grow,fill]"
"$rowConstraints": "[][][][][]para[][]para[]"
} ) {
name: "this"
@@ -141,6 +141,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7 2 1,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "Open Dialog"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7,alignx left,growx 0"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 380 )