> How do I force the repaint() method so I can get the result instantly?
post a sample program of how you are doing it. (just a frame with panel and button, actionlistener for the button to contain your int[][] and repaint() code)
Aji Prasetyo
Ranch Hand
Joined: Jun 13, 2007
Posts: 65
posted
0
post a sample program of how you are doing it.
This is how I do it:
What I want to do is regularly update the thearray[][] value using doPlots(int[][] thearray) method and directly display it in the panel.
Originally I am planning to use repaint() method to manually redraw the panel. But nothing happens. same with validate() method.
Is this problems is connected to the thread, because I use threads to keep changing the thearray[][] value?
it does work, as you can see from this (after stripping most of it - the stated problem being repaint() not called from doPlots())
you may notice you can copy/paste then click compile, click run and see it working. I could not do the same with what you posted.
Aji Prasetyo
Ranch Hand
Joined: Jun 13, 2007
Posts: 65
posted
0
Dear guys,
First of all, thank you for all of your effort to direct my problem.
But, sorry to tell you that the same problem still occurs.
This time, I have paste in this post the very program that causing the problem. If it is not too much of a problem, please take a look at those code. Feel free to copy-paste and Run the codes as it is.
This time I added 2 buttons on the left side of frame, one is for changing the background color into red and the other is for changing the background color into blue. This function also do not work. Maybe the problem is somehow has connection to the won't-repaint() problem.
Thank you so much for your time and efforts. Help me, please.
Aji Prasetyo
Ranch Hand
Joined: Jun 13, 2007
Posts: 65
posted
0
Hello again,
Sorry for the trouble, but in connection of the problem that I am asking, I want to consult a possible solution.
since the mouse listener can detect the mouse action and repaint() the panel properly, is it possible to put the object listener on the thearray[][] object. I mean, when thearray[][] object receive new value, the object listener catch it and repaint() the panel properly as if mouse listener do.