Paints the icon. @param c the component on which it is painted @param _g the graphics context @param x the x coordinate of the icon @param y the y coordinate of the icon
(Component c, Graphics _g, int x, int y)
| 93 | * @param y the y coordinate of the icon |
| 94 | */ |
| 95 | @Override |
| 96 | public void paintIcon(Component c, Graphics _g, int x, int y) { |
| 97 | Graphics2D g = (Graphics2D) _g; |
| 98 | Rectangle rect = new Rectangle(x, y, w, h); |
| 99 | Paint gPaint = g.getPaint(); |
| 100 | if (outline!=null) { |
| 101 | g.setPaint(outline); |
| 102 | g.fill(rect); |
| 103 | rect.setFrame(x+lineWidth, y+lineWidth, w-2*lineWidth, h-2*lineWidth); |
| 104 | } |
| 105 | g.setPaint(color); |
| 106 | g.fill(rect); |
| 107 | // restore graphics paint |
| 108 | g.setPaint(gPaint); |
| 109 | } |
| 110 | |
| 111 | } |
| 112 |