Piet Souris wrote:Is there any reason for using Buttons?
An easy alternative is to use a BufferedImage, that is updated in a separate Thread. Whenever that Thread is ready, it issues a repaint request for the panel at hand, maybe even controlled by a Timer. That repaint then simply draws that BufferedImage (or even better: this BI gets copied to another BI, and that BI is used in the painting).
Piet Souris wrote:I ran your code with a timerinterval of 1 second, and a grid of 10x10. There you see the change at once. Changing the grid to 100 * 100, is flooding the EDT with paint commands for your buttons, and that is a pretty slow process.
Therefore I asked if you had to use JButtons. It's okay to stay with that, but I do not see a solution then (but why is it a problem? The looks of it are fine, even with this 'continuous' updating).
Piet Souris wrote:A problem is that the method that is invoked by the Timer, might simply be too slow for the required number of repaints per second.