-
Class with graphics
When I use a textfield class, I declare an object and then I add it to the form and I can interact with it. I wanted to make a dice class (click and get a new random number). But how would I go about the drawing part? All the graphics/drawing I've come accross so far is on a JFrame (and the void paint method). Also do I need anything else special to be able to add it to a JFrame and interact with the class?
Hope this makes sense :D
Thanks :)
-
Re: Class with graphics
Well, I got pointed towards awt. I guess I have a lot of searching to do... Another idea someone had was to inherit another class (like textfield or something) and alter that...
Any thoughts on this?
-
Re: Class with graphics
java.awt.Graphics. Just turn the number into a String and use g.drawString(String s, int x, int y)
-
Re: Class with graphics
I always like created a differernt class for the drawing that extends Canvas. I liked the split functionality, and it makes it easier for the painting because sometimes it can get messy in the same class.