Changeset 11506 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-01-27T02:24:04+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MenuScroller.java
r9078 r11506 48 48 private final MenuScrollListener menuListener = new MenuScrollListener(); 49 49 private final MouseWheelListener mouseWheelListener = new MouseScrollListener(); 50 private int interval;51 50 private int topFixedCount; 52 51 private int firstIndex; … … 260 259 } 261 260 262 upItem = new MenuScrollItem(MenuIcon.UP, -1); 263 downItem = new MenuScrollItem(MenuIcon.DOWN, +1); 264 setInterval(interval); 261 upItem = new MenuScrollItem(MenuIcon.UP, -1, interval); 262 downItem = new MenuScrollItem(MenuIcon.DOWN, +1, interval); 265 263 setTopFixedCount(topFixedCount); 266 264 … … 268 266 menu.addPopupMenuListener(menuListener); 269 267 menu.addMouseWheelListener(mouseWheelListener); 270 }271 272 /**273 * Returns the scroll interval in milliseconds274 *275 * @return the scroll interval in milliseconds276 */277 public int getInterval() {278 return interval;279 }280 281 /**282 * Sets the scroll interval in milliseconds283 *284 * @param interval the scroll interval in milliseconds285 * @throws IllegalArgumentException if interval is 0 or negative286 */287 public void setInterval(int interval) {288 if (interval <= 0) {289 throw new IllegalArgumentException("interval must be greater than 0");290 }291 upItem.setInterval(interval);292 downItem.setInterval(interval);293 this.interval = interval;294 268 } 295 269 … … 445 419 private final MenuScrollTimer timer; 446 420 447 MenuScrollItem(MenuIcon icon, int increment ) {421 MenuScrollItem(MenuIcon icon, int increment, int interval) { 448 422 setIcon(icon); 449 423 setDisabledIcon(icon); 450 424 timer = new MenuScrollTimer(increment, interval); 451 425 addChangeListener(this); 452 }453 454 public void setInterval(int interval) {455 timer.setDelay(interval);456 426 } 457 427
Note:
See TracChangeset
for help on using the changeset viewer.