Results 1 to 3 of 3

Thread: draw irregular shape

  1. #1
    vastest
    Guest

    Exclamation draw irregular shape

    I want to draw a irregular shape on applet.
    u have any idea

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

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Something like:
    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);
        }
    }
    perhaps?

  3. #3
    vastest
    Guest
    Thanku very much.


    but now I can.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width