Changeset 4593 in josm


Ignore:
Timestamp:
2011-11-14T20:29:45+01:00 (8 years ago)
Author:
simon04
Message:

see #5638 - scroll long menus (thanks to tips4java.wordpress.com)

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r4590 r4593  
    22package org.openstreetmap.josm.gui;
    33
     4import java.awt.Toolkit;
    45import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    56import static org.openstreetmap.josm.tools.I18n.marktr;
     
    331332
    332333    public JMenu addMenu(String name, int mnemonicKey, int position, String relativeHelpTopic) {
    333         return addMenu(new JMenu(tr(name)), name, mnemonicKey, position, relativeHelpTopic);
     334        final JMenu menu = new JMenu(tr(name));
     335        int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
     336        int menuItemHeight = new JMenu().add(newAction).getPreferredSize().height;
     337        MenuScroller.setScrollerFor(menu, screenHeight / menuItemHeight);
     338        return addMenu(menu, name, mnemonicKey, position, relativeHelpTopic);
    334339    }
    335340
Note: See TracChangeset for help on using the changeset viewer.