mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
Menus: support alignment and text position properties (issue #3)
This commit is contained in:
@@ -18,8 +18,12 @@ package com.formdev.flatlaf.testing;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.*;
|
||||
import java.util.function.Supplier;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -38,6 +42,8 @@ public class FlatMenusTest
|
||||
|
||||
FlatMenusTest() {
|
||||
initComponents();
|
||||
|
||||
largerCheckBox.setSelected( LargerMenuItem.useLargerSize );
|
||||
}
|
||||
|
||||
private void armedChanged() {
|
||||
@@ -62,13 +68,65 @@ public class FlatMenusTest
|
||||
popupMenu.show( invoker, 0, invoker.getHeight() );
|
||||
}
|
||||
|
||||
private void largerChanged() {
|
||||
LargerMenuItem.useLargerSize = largerCheckBox.isSelected();
|
||||
menuBar2.revalidate();
|
||||
}
|
||||
|
||||
private void accelChanged() {
|
||||
updateAccel( menuBar2, () -> {
|
||||
return accelCheckBox.isSelected() ? getRandomKeyStroke() : null;
|
||||
} );
|
||||
}
|
||||
|
||||
private void updateAccel( Component c, Supplier<KeyStroke> keyStrokeSupplier ) {
|
||||
if( c instanceof JMenuItem && !(c instanceof JMenu) )
|
||||
((JMenuItem)c).setAccelerator( keyStrokeSupplier.get() );
|
||||
|
||||
if( c instanceof Container ) {
|
||||
for( Component c2 : ((Container)c).getComponents() )
|
||||
updateAccel( c2, keyStrokeSupplier );
|
||||
}
|
||||
if( c instanceof JMenu ) {
|
||||
randomKeyStrokeIndex = 0;
|
||||
JMenu menu = (JMenu) c;
|
||||
int itemCount = menu.getItemCount();
|
||||
for( int i = 0; i < itemCount; i++ )
|
||||
updateAccel( menu.getItem( i ), keyStrokeSupplier );
|
||||
}
|
||||
}
|
||||
|
||||
private KeyStroke getRandomKeyStroke() {
|
||||
if( randomKeyStrokeIndex >= randomKeyStrokes.length )
|
||||
randomKeyStrokeIndex = 0;
|
||||
return randomKeyStrokes[randomKeyStrokeIndex++];
|
||||
}
|
||||
|
||||
private int randomKeyStrokeIndex = 0;
|
||||
private final KeyStroke[] randomKeyStrokes = {
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_F2, 0 ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_A, KeyEvent.CTRL_MASK ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_B, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_BACK_SPACE, 0 ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_PAGE_UP, 0 ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_C, KeyEvent.ALT_MASK ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_F10, 0 ),
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_0, 0 ),
|
||||
};
|
||||
|
||||
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 menuItem35 = new JMenuItem();
|
||||
JMenuItem menuItem7 = new JMenuItem();
|
||||
JMenuItem menuItem34 = new JMenuItem();
|
||||
JMenuItem menuItem8 = new JMenuItem();
|
||||
JMenu menu11 = new JMenu();
|
||||
JMenuItem menuItem36 = new JMenuItem();
|
||||
JMenuItem menuItem37 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
||||
@@ -76,6 +134,34 @@ public class FlatMenusTest
|
||||
JMenu menu6 = new JMenu();
|
||||
JMenuItem menuItem5 = new JMenuItem();
|
||||
JMenuItem menuItem6 = new JMenuItem();
|
||||
menuBar2 = new JMenuBar();
|
||||
JMenu menu8 = new JMenu();
|
||||
FlatMenusTest.LargerMenuItem menuItem13 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem14 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem27 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem15 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem16 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem28 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem18 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem17 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem19 = new FlatMenusTest.LargerMenuItem();
|
||||
JMenuItem menuItem31 = new JMenuItem();
|
||||
JMenu menu9 = new JMenu();
|
||||
FlatMenusTest.LargerMenuItem menuItem20 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem21 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem29 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem22 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem23 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem30 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem25 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem24 = new FlatMenusTest.LargerMenuItem();
|
||||
FlatMenusTest.LargerMenuItem menuItem26 = new FlatMenusTest.LargerMenuItem();
|
||||
JMenuItem menuItem32 = new JMenuItem();
|
||||
JMenu menu10 = new JMenu();
|
||||
FlatMenusTest.LargerMenuItem menuItem33 = new FlatMenusTest.LargerMenuItem();
|
||||
JPanel panel5 = new JPanel();
|
||||
largerCheckBox = new JCheckBox();
|
||||
accelCheckBox = new JCheckBox();
|
||||
JPanel panel1 = new JPanel();
|
||||
JLabel menuLabel = new JLabel();
|
||||
JMenu menu1 = new JMenu();
|
||||
@@ -134,18 +220,43 @@ public class FlatMenusTest
|
||||
menu5.setMnemonic('T');
|
||||
menu5.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
||||
|
||||
//---- menuItem35 ----
|
||||
menuItem35.setText("text");
|
||||
menu5.add(menuItem35);
|
||||
|
||||
//---- menuItem7 ----
|
||||
menuItem7.setText("text");
|
||||
menuItem7.setMnemonic('X');
|
||||
menuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
||||
menuItem7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_MASK|KeyEvent.SHIFT_MASK));
|
||||
menu5.add(menuItem7);
|
||||
|
||||
//---- menuItem34 ----
|
||||
menuItem34.setText("longer text longer text");
|
||||
menuItem34.setMnemonic('E');
|
||||
menuItem34.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
|
||||
menu5.add(menuItem34);
|
||||
|
||||
//---- menuItem8 ----
|
||||
menuItem8.setText("text");
|
||||
menuItem8.setText("longer text longer text longer");
|
||||
menuItem8.setMnemonic('E');
|
||||
menuItem8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png")));
|
||||
menu5.add(menuItem8);
|
||||
|
||||
//======== menu11 ========
|
||||
{
|
||||
menu11.setText("sub menu");
|
||||
|
||||
//---- menuItem36 ----
|
||||
menuItem36.setText("text");
|
||||
menu11.add(menuItem36);
|
||||
|
||||
//---- menuItem37 ----
|
||||
menuItem37.setText("text");
|
||||
menu11.add(menuItem37);
|
||||
}
|
||||
menu5.add(menu11);
|
||||
menu5.addSeparator();
|
||||
|
||||
//---- checkBoxMenuItem6 ----
|
||||
checkBoxMenuItem6.setText("check");
|
||||
checkBoxMenuItem6.setSelected(true);
|
||||
@@ -180,7 +291,182 @@ public class FlatMenusTest
|
||||
}
|
||||
menuBar1.add(menu6);
|
||||
}
|
||||
add(menuBar1, "cell 1 0 4 1,growx");
|
||||
add(menuBar1, "cell 1 0 2 1,growx");
|
||||
|
||||
//======== menuBar2 ========
|
||||
{
|
||||
|
||||
//======== menu8 ========
|
||||
{
|
||||
menu8.setText("text position");
|
||||
menu8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
|
||||
menu8.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menu8.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
|
||||
//---- menuItem13 ----
|
||||
menuItem13.setText("vert top");
|
||||
menuItem13.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem13.setVerticalTextPosition(SwingConstants.TOP);
|
||||
menu8.add(menuItem13);
|
||||
|
||||
//---- menuItem14 ----
|
||||
menuItem14.setText("vert bottom");
|
||||
menuItem14.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem14.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
menu8.add(menuItem14);
|
||||
|
||||
//---- menuItem27 ----
|
||||
menuItem27.setText("horz leading");
|
||||
menuItem27.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem27.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||
menu8.add(menuItem27);
|
||||
|
||||
//---- menuItem15 ----
|
||||
menuItem15.setText("horz left");
|
||||
menuItem15.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem15.setHorizontalTextPosition(SwingConstants.LEFT);
|
||||
menu8.add(menuItem15);
|
||||
|
||||
//---- menuItem16 ----
|
||||
menuItem16.setText("horz right");
|
||||
menuItem16.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem16.setHorizontalTextPosition(SwingConstants.RIGHT);
|
||||
menu8.add(menuItem16);
|
||||
|
||||
//---- menuItem28 ----
|
||||
menuItem28.setText("horz trailing");
|
||||
menuItem28.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menu8.add(menuItem28);
|
||||
|
||||
//---- menuItem18 ----
|
||||
menuItem18.setText("horz center / vert top");
|
||||
menuItem18.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem18.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menuItem18.setVerticalTextPosition(SwingConstants.TOP);
|
||||
menu8.add(menuItem18);
|
||||
|
||||
//---- menuItem17 ----
|
||||
menuItem17.setText("horz center / vert bottom");
|
||||
menuItem17.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem17.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menuItem17.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
menu8.add(menuItem17);
|
||||
|
||||
//---- menuItem19 ----
|
||||
menuItem19.setText("horz center / vert center");
|
||||
menuItem19.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem19.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menu8.add(menuItem19);
|
||||
|
||||
//---- menuItem31 ----
|
||||
menuItem31.setText("1234567890123456789012345678901234567890");
|
||||
menu8.add(menuItem31);
|
||||
}
|
||||
menuBar2.add(menu8);
|
||||
|
||||
//======== menu9 ========
|
||||
{
|
||||
menu9.setText("alignment");
|
||||
menu9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
|
||||
menu9.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menu9.setVerticalTextPosition(SwingConstants.TOP);
|
||||
|
||||
//---- menuItem20 ----
|
||||
menuItem20.setText("vert top");
|
||||
menuItem20.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem20.setVerticalAlignment(SwingConstants.TOP);
|
||||
menu9.add(menuItem20);
|
||||
|
||||
//---- menuItem21 ----
|
||||
menuItem21.setText("vert bottom");
|
||||
menuItem21.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem21.setVerticalAlignment(SwingConstants.BOTTOM);
|
||||
menu9.add(menuItem21);
|
||||
|
||||
//---- menuItem29 ----
|
||||
menuItem29.setText("horz leading");
|
||||
menuItem29.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menu9.add(menuItem29);
|
||||
|
||||
//---- menuItem22 ----
|
||||
menuItem22.setText("horz left");
|
||||
menuItem22.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem22.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
menu9.add(menuItem22);
|
||||
|
||||
//---- menuItem23 ----
|
||||
menuItem23.setText("horz right");
|
||||
menuItem23.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem23.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
menu9.add(menuItem23);
|
||||
|
||||
//---- menuItem30 ----
|
||||
menuItem30.setText("horz trailing");
|
||||
menuItem30.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem30.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
menu9.add(menuItem30);
|
||||
|
||||
//---- menuItem25 ----
|
||||
menuItem25.setText("horz center / vert top");
|
||||
menuItem25.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem25.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
menuItem25.setVerticalAlignment(SwingConstants.TOP);
|
||||
menu9.add(menuItem25);
|
||||
|
||||
//---- menuItem24 ----
|
||||
menuItem24.setText("horz center / vert bottom");
|
||||
menuItem24.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem24.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
menuItem24.setVerticalAlignment(SwingConstants.BOTTOM);
|
||||
menu9.add(menuItem24);
|
||||
|
||||
//---- menuItem26 ----
|
||||
menuItem26.setText("horz center / vert center");
|
||||
menuItem26.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menuItem26.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
menu9.add(menuItem26);
|
||||
|
||||
//---- menuItem32 ----
|
||||
menuItem32.setText("1234567890123456789012345678901234567890");
|
||||
menu9.add(menuItem32);
|
||||
}
|
||||
menuBar2.add(menu9);
|
||||
|
||||
//======== menu10 ========
|
||||
{
|
||||
menu10.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menu10.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
menu10.setVerticalTextPosition(SwingConstants.TOP);
|
||||
|
||||
//---- menuItem33 ----
|
||||
menuItem33.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
|
||||
menu10.add(menuItem33);
|
||||
}
|
||||
menuBar2.add(menu10);
|
||||
}
|
||||
add(menuBar2, "cell 3 0 2 1,growx");
|
||||
|
||||
//======== panel5 ========
|
||||
{
|
||||
panel5.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]",
|
||||
// rows
|
||||
"[]0" +
|
||||
"[]"));
|
||||
|
||||
//---- largerCheckBox ----
|
||||
largerCheckBox.setText("larger");
|
||||
largerCheckBox.addActionListener(e -> largerChanged());
|
||||
panel5.add(largerCheckBox, "cell 0 0");
|
||||
|
||||
//---- accelCheckBox ----
|
||||
accelCheckBox.setText("accel");
|
||||
accelCheckBox.addActionListener(e -> accelChanged());
|
||||
panel5.add(accelCheckBox, "cell 0 1");
|
||||
}
|
||||
add(panel5, "cell 3 0 2 1");
|
||||
|
||||
//======== panel1 ========
|
||||
{
|
||||
@@ -397,9 +683,14 @@ public class FlatMenusTest
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JMenuBar menuBar2;
|
||||
private JCheckBox largerCheckBox;
|
||||
private JCheckBox accelCheckBox;
|
||||
private JCheckBox armedCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class PopupMenu ----------------------------------------------------
|
||||
|
||||
private class PopupMenu extends JPopupMenu {
|
||||
private PopupMenu() {
|
||||
initComponents();
|
||||
@@ -449,4 +740,30 @@ public class FlatMenusTest
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
//---- class LargerMenuItem -----------------------------------------------
|
||||
|
||||
public static class LargerMenuItem
|
||||
extends JMenuItem
|
||||
{
|
||||
static boolean useLargerSize = true;
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size = super.getPreferredSize();
|
||||
return useLargerSize
|
||||
? new Dimension( size.width + UIScale.scale( 40 ),
|
||||
size.height + UIScale.scale( 30 ) )
|
||||
: size;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintComponent( g );
|
||||
|
||||
g.setColor( UIManager.getColor( "Separator.foreground" ) );
|
||||
g.drawLine( 0, 0, getWidth(), 0 );
|
||||
g.drawLine( 0, getHeight(), getWidth(), getHeight() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,17 +25,42 @@ new FormModel {
|
||||
"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: "menuItem35"
|
||||
"text": "text"
|
||||
} )
|
||||
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" )
|
||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 74, 195, false )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem34"
|
||||
"text": "longer text longer text"
|
||||
"mnemonic": 69
|
||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 115, 0, false )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem8"
|
||||
"text": "text"
|
||||
"text": "longer text longer text longer"
|
||||
"mnemonic": 69
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png" )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu11"
|
||||
"text": "sub menu"
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem36"
|
||||
"text": "text"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem37"
|
||||
"text": "text"
|
||||
} )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
||||
name: "separator3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem6"
|
||||
@@ -72,7 +97,186 @@ new FormModel {
|
||||
} )
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0 4 1,growx"
|
||||
"value": "cell 1 0 2 1,growx"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
|
||||
name: "menuBar2"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu8"
|
||||
"text": "text position"
|
||||
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png" )
|
||||
"horizontalTextPosition": 0
|
||||
"verticalTextPosition": 3
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem13"
|
||||
"text": "vert top"
|
||||
"icon": &SwingIcon1 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
|
||||
"verticalTextPosition": 1
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem14"
|
||||
"text": "vert bottom"
|
||||
"icon": #SwingIcon1
|
||||
"verticalTextPosition": 3
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem27"
|
||||
"text": "horz leading"
|
||||
"icon": &SwingIcon2 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
|
||||
"horizontalTextPosition": 10
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem15"
|
||||
"text": "horz left"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalTextPosition": 2
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem16"
|
||||
"text": "horz right"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalTextPosition": 4
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem28"
|
||||
"text": "horz trailing"
|
||||
"icon": #SwingIcon2
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem18"
|
||||
"text": "horz center / vert top"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalTextPosition": 0
|
||||
"verticalTextPosition": 1
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem17"
|
||||
"text": "horz center / vert bottom"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalTextPosition": 0
|
||||
"verticalTextPosition": 3
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem19"
|
||||
"text": "horz center / vert center"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalTextPosition": 0
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem31"
|
||||
"text": "1234567890123456789012345678901234567890"
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu9"
|
||||
"text": "alignment"
|
||||
"icon": #SwingIcon0
|
||||
"horizontalTextPosition": 0
|
||||
"verticalTextPosition": 1
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem20"
|
||||
"text": "vert top"
|
||||
"icon": #SwingIcon1
|
||||
"verticalAlignment": 1
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem21"
|
||||
"text": "vert bottom"
|
||||
"icon": #SwingIcon1
|
||||
"verticalAlignment": 3
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem29"
|
||||
"text": "horz leading"
|
||||
"icon": #SwingIcon2
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem22"
|
||||
"text": "horz left"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 2
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem23"
|
||||
"text": "horz right"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 4
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem30"
|
||||
"text": "horz trailing"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 11
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem25"
|
||||
"text": "horz center / vert top"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 0
|
||||
"verticalAlignment": 1
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem24"
|
||||
"text": "horz center / vert bottom"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 0
|
||||
"verticalAlignment": 3
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem26"
|
||||
"text": "horz center / vert center"
|
||||
"icon": #SwingIcon2
|
||||
"horizontalAlignment": 0
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem32"
|
||||
"text": "1234567890123456789012345678901234567890"
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu10"
|
||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
|
||||
"horizontalTextPosition": 0
|
||||
"verticalTextPosition": 1
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
|
||||
name: "menuItem33"
|
||||
"icon": #SwingIcon1
|
||||
} )
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 0 2 1,growx"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[]"
|
||||
"$rowConstraints": "[]0[]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel5"
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "largerCheckBox"
|
||||
"text": "larger"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "largerChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "accelCheckBox"
|
||||
"text": "accel"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "accelChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 0 2 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[125,left][fill]"
|
||||
|
||||
Reference in New Issue
Block a user