MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / paintIcon

Method paintIcon

src/org/opensourcephysics/display/ColorIcon.java:95–109  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

93 * @param y the y coordinate of the icon
94 */
95 @Override
96public 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

Callers

nothing calls this directly

Calls 3

getPaintMethod · 0.80
setPaintMethod · 0.80
fillMethod · 0.45

Tested by

no test coverage detected