mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Menus: scroll large menus using mouse wheel or up/down arrows (issue #225)
This commit is contained in:
@@ -464,6 +464,7 @@ class DemoFrame
|
||||
JMenuItem projectViewMenuItem = new JMenuItem();
|
||||
JMenuItem structureViewMenuItem = new JMenuItem();
|
||||
JMenuItem propertiesViewMenuItem = new JMenuItem();
|
||||
scrollingPopupMenu = new JMenu();
|
||||
JMenuItem menuItem2 = new JMenuItem();
|
||||
htmlMenuItem = new JMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem1 = new JRadioButtonMenuItem();
|
||||
@@ -668,6 +669,12 @@ class DemoFrame
|
||||
}
|
||||
viewMenu.add(menu1);
|
||||
|
||||
//======== scrollingPopupMenu ========
|
||||
{
|
||||
scrollingPopupMenu.setText("Scrolling Popup Menu");
|
||||
}
|
||||
viewMenu.add(scrollingPopupMenu);
|
||||
|
||||
//---- menuItem2 ----
|
||||
menuItem2.setText("Disabled Item");
|
||||
menuItem2.setEnabled(false);
|
||||
@@ -889,6 +896,12 @@ class DemoFrame
|
||||
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
||||
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
||||
|
||||
scrollingPopupMenu.add( "Large menus are scrollable" );
|
||||
scrollingPopupMenu.add( "Use mouse wheel to scroll" );
|
||||
scrollingPopupMenu.add( "Or use up/down arrows at top/bottom" );
|
||||
for( int i = 1; i <= 100; i++ )
|
||||
scrollingPopupMenu.add( "Item " + i );
|
||||
|
||||
if( FlatLaf.supportsNativeWindowDecorations() || (SystemInfo.isLinux && JFrame.isDefaultLookAndFeelDecorated()) ) {
|
||||
if( SystemInfo.isLinux )
|
||||
unsupported( windowDecorationsCheckBoxMenuItem );
|
||||
@@ -934,6 +947,7 @@ class DemoFrame
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JMenuItem exitMenuItem;
|
||||
private JMenu scrollingPopupMenu;
|
||||
private JMenuItem htmlMenuItem;
|
||||
private JMenu fontMenu;
|
||||
private JMenu optionsMenu;
|
||||
|
||||
@@ -282,6 +282,13 @@ new FormModel {
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "scrollingPopupMenu"
|
||||
"text": "Scrolling Popup Menu"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem2"
|
||||
"text": "Disabled Item"
|
||||
|
||||
Reference in New Issue
Block a user