• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphics: triangle()?

 
Jason Shadle
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all...first post. Tons of help great info on this site. Will be using frequently.

So first question:

What class,method, or even formula, can I use to create a triangle on my applet? It's strange to me that there is a fillOval, fillRect, etc...But there is no fillTriangle, or drawTriangle?


Thanks in advance.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Shadle wrote:Hello all...first post. Tons of help great info on this site. Will be using frequently.

And a hearty welcome to the Ranch!

What class,method, or even formula, can I use to create a triangle on my applet? It's strange to me that there is a fillOval, fillRect, etc...But there is no fillTriangle, or drawTriangle?


Similarly, there's no drawPentagon, drawHexagon, drawHeptagon, drawOctagon, etc...
But if they did have some of these, where would they draw the line and have no more?

Check out the API entry for the Graphics class and you'll see many other useful methods including drawPolygon and fillPolygon. Also if you want to delve into Graphics2D, you'll likewise find some classes that implement Shape that you can use.

Much luck!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic