![]() |
|
#1
|
|||
|
|||
Paint helpI've got issues with accessing my paint method in a class. I have a paint method in a class called Canvas - basically this paint method will draw me a grid and colour each cell the colour black when the mouse is clicked a cell. Lets say i've clicked a few cells and they're black. That code is here as follows:
JAVA Code:
Ok, so this alll works fine. But on my actual GUI, i have a button called "Clear". This clear button is in class Frame, and this clear button should repaint the whole grid (with no cells in black). Now, i'm trying to call the paint method when the Clear button is pressed, just not sure of how to do that. I tried calling the paint component directly, that didn't help. Any ideas from you guys? Edit/Delete Message Last edited by cable_guy_67 : 04-Jun-2006 at 07:53.
Reason: Please enclose java code in [java] ... [/java] tags
|
|
#2
|
||||
|
||||
Re: Paint helpWhat is the 'type' of your grid?
I helped someone else with another type of grid-coloring, but their 'grid' was a two dimensional array of JButtons, and the paint method was not necessary because of direct button coloring via setBackground() button calls, check it out here: http://www.gidforums.com/showpost.ph...6&postcount=13 [their 'clear' button resets all the buttons to green -- see function colorButtons()] If you'd like to keep your code, post more of your code (if you can), and we'll try a solution for the clear. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The