Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Drawing triangles in Applet

807597Aug 13 2005 — edited Aug 13 2005
hi Friends,
I need to draw some triangles in sequence in an applet.I have drawn two triangles to start with,the code for which is:
public class triangle extends Applet {

  public void paint (Graphics g)
  {
    g.drawLine(50,50,25,100);
    g.drawLine(25,100,75,100);
    g.drawLine(50,50,75,100);
   
    g.drawLine(100,50,125,100);
    g.drawLine(75,100,100,50);
    g.drawLine(75,100,125,100);
  } 

}
But,I dont think this is the right way .. can you please tell me how can i use a method where I can send the 3 points and it returns me with a triangle and in the end i merge all those triangles.Please help me guys.
Thanks
Mick
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2005
Added on Aug 13 2005
1 comment
737 views