• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hi i'm trying to do a triangle

 
Nathalie Monvoisin
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i'm trying to do a method which will draw a triangle and then the method will be called when we click on a specific button. can anyone help on how i must proceed.
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell us more. Is this Swing / AWT / SWT / JavaFX / something else?

If you're asking about Swing, start with the tutorial on Performing Custom Painting.
 
Nathalie Monvoisin
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your reply Darryl Burke, i was able to resolve it on my own
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And this being a forum you will share your solution to benefit others, won't you?
 
Nathalie Monvoisin
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course
so what i have done, instead of writing a method and then call it in a JButton.
what i have done is that i wrote the code for the triangle directly in the button, so that when i press the button the triangle is displayed.
Hope it help other
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!