Changeset 10625 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-07-24T13:42:32+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10616 r10625 675 675 } 676 676 677 private final transient AWTEventListener awtListener = new AWTEventListener() { 678 @Override 679 public void eventDispatched(AWTEvent event) { 680 if (event instanceof InputEvent && 681 ((InputEvent) event).getComponent() == mv) { 682 synchronized (collector) { 683 int modifiers = ((InputEvent) event).getModifiersEx(); 684 Point mousePos = null; 685 if (event instanceof MouseEvent) { 686 mousePos = ((MouseEvent) event).getPoint(); 687 } 688 collector.updateMousePosition(mousePos, modifiers); 689 } 690 } 691 } 692 }; 677 private final transient AWTEventListener awtListener; 693 678 694 679 private final transient MouseMotionListener mouseMotionListener = new MouseMotionListener() { … … 719 704 720 705 private void registerListeners() { 721 // Listen to keyboard/mouse events for pressing/releasing alt key and 722 // inform the collector. 706 // Listen to keyboard/mouse events for pressing/releasing alt key and inform the collector. 723 707 try { 724 708 Toolkit.getDefaultToolkit().addAWTEventListener(awtListener, 725 709 AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 726 710 } catch (SecurityException ex) { 711 Main.trace(ex); 727 712 mv.addMouseMotionListener(mouseMotionListener); 728 713 mv.addKeyListener(keyAdapter); … … 735 720 } catch (SecurityException e) { 736 721 // Don't care, awtListener probably wasn't registered anyway 737 if (Main.isTraceEnabled()) { 738 Main.trace(e.getMessage()); 739 } 722 Main.trace(e); 740 723 } 741 724 mv.removeMouseMotionListener(mouseMotionListener); … … 826 809 this.mv = mapFrame.mapView; 827 810 this.collector = new Collector(mapFrame); 811 this.awtListener = event -> { 812 if (event instanceof InputEvent && 813 ((InputEvent) event).getComponent() == mv) { 814 synchronized (collector) { 815 int modifiers = ((InputEvent) event).getModifiersEx(); 816 Point mousePos = null; 817 if (event instanceof MouseEvent) { 818 mousePos = ((MouseEvent) event).getPoint(); 819 } 820 collector.updateMousePosition(mousePos, modifiers); 821 } 822 } 823 }; 828 824 829 825 // Context menu of status bar -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r10616 r10625 737 737 738 738 public static TranslationAdapter getTranslationAdapter() { 739 return (text, objects) -> I18n.tr(text, objects);739 return I18n::tr; 740 740 } 741 741
Note:
See TracChangeset
for help on using the changeset viewer.