Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Graphics: triangle()?

 
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.
 
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!
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic