MenuBar basic implementation

This commit is contained in:
Karl Tauber
2019-08-31 14:24:46 +02:00
parent 611296037c
commit 9b1214572b
8 changed files with 220 additions and 16 deletions

View File

@@ -54,6 +54,14 @@ public class FlatMenusTest
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel menuBarLabel = new JLabel();
JMenuBar menuBar1 = new JMenuBar();
JMenu menu5 = new JMenu();
JMenuItem menuItem7 = new JMenuItem();
JMenuItem menuItem8 = new JMenuItem();
JMenu menu6 = new JMenu();
JMenuItem menuItem5 = new JMenuItem();
JMenuItem menuItem6 = new JMenuItem();
JPanel panel1 = new JPanel();
JLabel menuLabel = new JLabel();
JMenu menu1 = new JMenu();
@@ -84,20 +92,60 @@ public class FlatMenusTest
setLayout(new MigLayout(
"insets 0,hidemode 3,gap 5 5,ltr",
// columns
"[125]" +
"[]" +
"[]" +
"[]" +
"[]",
// rows
"[]" +
"[top]" +
"[]" +
"[]"));
//---- menuBarLabel ----
menuBarLabel.setText("JMenuBar:");
add(menuBarLabel, "cell 0 0");
//======== menuBar1 ========
{
//======== menu5 ========
{
menu5.setText("text");
//---- menuItem7 ----
menuItem7.setText("text");
menu5.add(menuItem7);
//---- menuItem8 ----
menuItem8.setText("text");
menu5.add(menuItem8);
}
menuBar1.add(menu5);
//======== menu6 ========
{
menu6.setText("text");
//---- menuItem5 ----
menuItem5.setText("text");
menu6.add(menuItem5);
//---- menuItem6 ----
menuItem6.setText("text");
menu6.add(menuItem6);
}
menuBar1.add(menu6);
}
add(menuBar1, "cell 1 0 4 1,growx");
//======== panel1 ========
{
panel1.setLayout(new MigLayout(
"insets 0,hidemode 3,gap 5 5,ltr",
// columns
"[left]" +
"[125,left]" +
"[fill]",
// rows
"[]" +
@@ -142,12 +190,12 @@ public class FlatMenusTest
radioButtonMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel1.add(radioButtonMenuItem1, "cell 1 3");
}
add(panel1, "cell 0 0");
add(panel1, "cell 0 1 2 1");
//======== panel2 ========
{
panel2.setLayout(new MigLayout(
"insets 0,hidemode 3,gap 5 5",
"insets 0,gap 5 5",
// columns
"[fill]",
// rows
@@ -181,7 +229,7 @@ public class FlatMenusTest
radioButtonMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel2.add(radioButtonMenuItem2, "cell 0 3");
}
add(panel2, "cell 1 0");
add(panel2, "cell 2 1");
//======== panel3 ========
{
@@ -220,7 +268,7 @@ public class FlatMenusTest
radioButtonMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel3.add(radioButtonMenuItem3, "cell 0 3");
}
add(panel3, "cell 2 0");
add(panel3, "cell 3 1");
//======== panel4 ========
{
@@ -262,13 +310,13 @@ public class FlatMenusTest
radioButtonMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel4.add(radioButtonMenuItem4, "cell 0 3");
}
add(panel4, "cell 3 0");
add(panel4, "cell 4 1");
//---- armedCheckBox ----
armedCheckBox.setText("armed");
armedCheckBox.setMnemonic('A');
armedCheckBox.addActionListener(e -> armedChanged());
add(armedCheckBox, "cell 0 1");
add(armedCheckBox, "cell 0 2 2 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}

View File

@@ -8,12 +8,47 @@ new FormModel {
}
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
"$columnConstraints": "[][][][]"
"$rowConstraints": "[top][]"
"$columnConstraints": "[125][][][][]"
"$rowConstraints": "[][top][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "menuBarLabel"
"text": "JMenuBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
name: "menuBar1"
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu5"
"text": "text"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem7"
"text": "text"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem8"
"text": "text"
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu6"
"text": "text"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem5"
"text": "text"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem6"
"text": "text"
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0 4 1,growx"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[left][fill]"
"$columnConstraints": "[125,left][fill]"
"$rowConstraints": "[][][][]"
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
} ) {
@@ -70,12 +105,12 @@ new FormModel {
"value": "cell 1 3"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
"value": "cell 0 1 2 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]"
"$rowConstraints": "[][][][]"
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5"
"$layoutConstraints": "insets 0,gap 5 5"
} ) {
name: "panel2"
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
@@ -110,7 +145,7 @@ new FormModel {
"value": "cell 0 3"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
"value": "cell 2 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]"
@@ -150,7 +185,7 @@ new FormModel {
"value": "cell 0 3"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0"
"value": "cell 3 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]"
@@ -193,7 +228,7 @@ new FormModel {
"value": "cell 0 3"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0"
"value": "cell 4 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "armedCheckBox"
@@ -204,7 +239,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "armedChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
"value": "cell 0 2 2 1"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )

View File

@@ -110,6 +110,11 @@ Menu.icon.arrowColor=4D89C9
Menu.icon.disabledArrowColor=ABABAB
#---- MenuBar ----
MenuBar.borderColor=4444ff
#---- MenuItemCheckBox ----
MenuItemCheckBox.icon.checkmarkColor=4D89C9