How to draw star in java swing using fillPolygon -
i'm having trouble setting coordinate of star there better solution this. cannot the correct shape. can me on this?
public void star(graphics shapes) { shapes.setcolor(color); int[] x = {42,52,72,52,60,40,15,28,9,32,42}; int [] y = {38,62,68,80,105,85,102,75,58,20,38}; shapes.fillpolygon(x, y, 5); }
sun's implementation provides custom java 2d shapes rectangle
, oval
, polygon
etc. it's not enough. there guis require more custom shapes regular polygon
, star
, regular polygon
rounded corners. project provides more shapes used. classes implements shape
interface allows user use usual methods of graphics2d
fill()
, draw()
, , create own shapes combining them.
edit:
Comments
Post a Comment