I want to draw a irregular shape on applet.
u have any idea
please....................
Printable View
I want to draw a irregular shape on applet.
u have any idea
please....................
Something like:
perhaps?Code:import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Color;
public class polytest extends java.applet.Applet
{
private Rectangle rect;
private int[] px =
{ 10,310,260,410,260,310, 10, 60 };
private int[] py =
{ 10, 70, 30, 90,150,110,170, 90 };
public void init() {
rect = getBounds();
setBackground(Color.yellow);
}
public void paint(Graphics g) {
int x;
int y;
g.setColor(Color.red);
g.fillPolygon(px,py,8);
g.setColor(Color.black);
g.drawPolygon(px,py,8);
}
}
Thanku very much.
but now I can.