Changeset 12778 in osm for applications/editors/josm/plugins/slippy_map_chooser/src/SizeButton.java
- Timestamp:
- 2009-01-01T18:28:53+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippy_map_chooser/src/SizeButton.java
r7199 r12778 15 15 */ 16 16 public class SizeButton{ 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 17 18 private int x = 0; 19 private int y = 0; 20 21 private ImageIcon enlargeImage; 22 private ImageIcon shrinkImage; 23 private boolean isEnlarged = false; 24 25 26 public SizeButton(){ 27 enlargeImage = ImageProvider.get("", "view-fullscreen.png"); 28 shrinkImage = ImageProvider.get("", "view-fullscreen-revert.png"); 29 } 30 31 public void paint(Graphics g){ 32 if(isEnlarged){ 33 if(shrinkImage != null) 34 g.drawImage(shrinkImage.getImage(),x,y, null); 35 }else{ 36 if(enlargeImage != null) 37 g.drawImage(enlargeImage.getImage(),x,y, null); 38 } 39 } 40 41 public void toggle(){ 42 isEnlarged = !isEnlarged; 43 } 44 45 public boolean hit(Point point){ 46 if(x < point.x && point.x < x + enlargeImage.getIconWidth()){ 47 if(y < point.y && point.y < y + enlargeImage.getIconHeight() ){ 48 return true; 49 } 50 } 51 return false; 52 } 53 53 54 54 }
Note:
See TracChangeset
for help on using the changeset viewer.