PDA

Click to See Complete Forum and Search --> : draw irregular shape


vastest
Jun 24th, 2002, 05:05 AM
I want to draw a irregular shape on applet.
u have any idea

please....................

ccoder
Jun 25th, 2002, 01:31 PM
Something like:

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);
}
}

perhaps?

vastest
Jun 27th, 2002, 05:51 AM
Thanku very much.


but now I can.