Changeset 5185 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-04-15T00:00:33+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r4162 r5185 10 10 import java.awt.Font; 11 11 import java.awt.Graphics; 12 import java.awt.Toolkit; 12 13 import java.awt.event.ActionEvent; 13 14 import java.awt.image.BufferedImage; … … 23 24 import javax.swing.JMenu; 24 25 import javax.swing.JMenuItem; 26 import javax.swing.JPopupMenu; 25 27 import javax.swing.JSeparator; 26 28 import javax.swing.SwingUtilities; … … 34 36 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 35 37 import org.openstreetmap.josm.data.preferences.IntegerProperty; 38 import org.openstreetmap.josm.gui.MenuScroller; 36 39 import org.openstreetmap.josm.io.imagery.OffsetServer; 37 40 import org.openstreetmap.josm.io.imagery.OsmosnimkiOffsetServer; … … 205 208 subMenu.add(new JSeparator()); 206 209 boolean hasBookmarks = false; 210 int menuItemHeight = 0; 207 211 for (OffsetBookmark b : OffsetBookmark.allBookmarks) { 208 212 if (!b.isUsable(this)) { … … 214 218 } 215 219 subMenu.add(item); 220 menuItemHeight = item.getPreferredSize().height; 216 221 hasBookmarks = true; 222 } 223 if (menuItemHeight > 0) { 224 int scrollcount = (Toolkit.getDefaultToolkit().getScreenSize().height / menuItemHeight) - 1; 225 if (subMenu instanceof JMenu) { 226 MenuScroller.setScrollerFor((JMenu) subMenu, scrollcount); 227 } else if (subMenu instanceof JPopupMenu) { 228 MenuScroller.setScrollerFor((JPopupMenu)subMenu, scrollcount); 229 } 217 230 } 218 231 return (hasBookmarks || offsetServerSupported) ? subMenu : adjustMenuItem;
Note:
See TracChangeset
for help on using the changeset viewer.