Changeset 6603 in josm for trunk/src/org/openstreetmap/josm/gui/bbox
- Timestamp:
- 2014-01-03T04:51:04+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SourceButton.java
r6539 r6603 24 24 public class SourceButton extends JComponent { 25 25 26 private final int layerHeight = 20; 27 private final int leftPadding = 5; 28 private final int topPadding = 5; 29 private final int bottomPadding = 5; 30 26 private static final int LAYER_HEIGHT = 20; 27 private static final int LEFT_PADDING = 5; 28 private static final int TOP_PADDING = 5; 29 private static final int BOTTOM_PADDING = 5; 31 30 32 31 private TileSource[] sources; … … 47 46 48 47 public SourceButton(SlippyMapBBoxChooser slippyMapBBoxChooser, Collection<TileSource> sources) { 49 super();50 48 this.slippyMapBBoxChooser = slippyMapBBoxChooser; 51 49 setSources(sources); … … 68 66 toggle(); 69 67 } else { 70 int result = (point.y - 5) / layerHeight;68 int result = (point.y - 5) / LAYER_HEIGHT; 71 69 if (result >= 0 && result < SourceButton.this.sources.length) { 72 70 SourceButton.this.slippyMapBBoxChooser.toggleMapSource(SourceButton.this.sources[result]); … … 78 76 toggle(); 79 77 } 80 81 78 } 82 79 } … … 105 102 106 103 g.setColor(new Color(0, 0, 139, 179)); 107 g.fillRoundRect(0, 0, barWidth + shrinkImage.getIconWidth(), sources.length * layerHeight + topPadding + bottomPadding, 10, 10);104 g.fillRoundRect(0, 0, barWidth + shrinkImage.getIconWidth(), sources.length * LAYER_HEIGHT + TOP_PADDING + BOTTOM_PADDING, 10, 10); 108 105 for (int i=0; i<sources.length; i++) { 109 106 g.setColor(Color.WHITE); 110 g.fillOval( leftPadding, topPadding + i * layerHeight+ 6, radioButtonSize, radioButtonSize);111 g.drawString(sources[i].getName(), leftPadding + radioButtonSize + leftPadding, topPadding + i * layerHeight+ g.getFontMetrics().getHeight());107 g.fillOval(LEFT_PADDING, TOP_PADDING + i * LAYER_HEIGHT + 6, radioButtonSize, radioButtonSize); 108 g.drawString(sources[i].getName(), LEFT_PADDING + radioButtonSize + LEFT_PADDING, TOP_PADDING + i * LAYER_HEIGHT + g.getFontMetrics().getHeight()); 112 109 if (currentMap == i) { 113 110 g.setColor(Color.BLACK); 114 g.fillOval( leftPadding + 1, topPadding + 7 + i * layerHeight, radioButtonSize - 2, radioButtonSize - 2);111 g.fillOval(LEFT_PADDING + 1, TOP_PADDING + 7 + i * LAYER_HEIGHT, radioButtonSize - 2, radioButtonSize - 2); 115 112 } 116 113 } … … 155 152 } 156 153 barWidth = textWidth + 50; 157 shownDimension = new Dimension(barWidth + shrinkImage.getIconWidth(), sources.length * layerHeight + topPadding + bottomPadding);154 shownDimension = new Dimension(barWidth + shrinkImage.getIconWidth(), sources.length * LAYER_HEIGHT + TOP_PADDING + BOTTOM_PADDING); 158 155 } 159 156 }
Note:
See TracChangeset
for help on using the changeset viewer.