Ignore:
Timestamp:
2010-10-22T21:38:47+02:00 (14 years ago)
Author:
oliverw
Message:

Improved drawLabel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java

    r23753 r23755  
    4141                IElevationProfileRenderer {
    4242
     43        private static final int ROUND_RECT_RADIUS = 8;
    4344        /**
    4445         *
     
    384385                Graphics2D g2d = (Graphics2D) g;
    385386
    386                 int width = g.getFontMetrics(g.getFont()).stringWidth(s) + 5;
    387                 int height = g.getFont().getSize() + g.getFontMetrics().getLeading();
     387                int width = g.getFontMetrics(g.getFont()).stringWidth(s) + 10;
     388                int height = g.getFont().getSize() + g.getFontMetrics().getLeading() + 5;
    388389
    389390                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    390391                                RenderingHints.VALUE_ANTIALIAS_ON);
     392               
    391393                GradientPaint gradient = new GradientPaint(x, y, Color.WHITE, x, y
    392                                 + height, Color.GRAY, false);
    393                 g2d.setPaint(gradient);
    394 
    395                 Rectangle r = new Rectangle(x - (width / 2) - 2, y - (height / 2) - 1, width, height);
     394                                + height, Color.BLACK, false);
     395                g2d.setPaint(gradient);         
     396
     397                Rectangle r = new Rectangle(x - (width / 2) - 5, y - (height / 2) + 1, width, height);
    396398                g2d.fillRect(r.x, r.y, r.width, r.height);
    397399               
    398400                g2d.setColor(Color.BLACK);
    399                 g2d.drawRoundRect(r.x, r.y, r.width, r.height, 2, 2);
     401               
     402                g2d.drawRoundRect(r.x, r.y, r.width, r.height, ROUND_RECT_RADIUS, ROUND_RECT_RADIUS);
    400403                g2d.drawString(s, x - width / 2, y + (height / 2) - 2);
    401404        }
Note: See TracChangeset for help on using the changeset viewer.