L
Lee Garrington
Hello,
Basically this is my problem. I am programming minesweeper in java. I have
a panel in the background on which I draw all the mines/numbers etc. and
then I have an array of buttons that sit on top of them.
I am developing a solver and need a pause between each move the algorithm
makes. I know from my past experience that you have to use something along
the lines of :-
Graphics g = board.getGraphics();
board.paintComponent(g);
g.dispose();
to get the board to update after each successive move but I seem to be
having problems getting it working properly.
- If I use the above to repaint the background then all the buttons
disappear.
- If I use the above to repaint all the buttons it doesnt actually repaint
them, it just goes grey.
-If I try and repaint both, wherever moves are made by the computer you can
see the relevant square in the background but none of the other buttons are
drawn and its just grey instead.
After completeing the algorithm it all redraws as normal.
I just want everything to refresh as normal when each move by the computer
is made, can anyone help me out?
Thx in advance
Basically this is my problem. I am programming minesweeper in java. I have
a panel in the background on which I draw all the mines/numbers etc. and
then I have an array of buttons that sit on top of them.
I am developing a solver and need a pause between each move the algorithm
makes. I know from my past experience that you have to use something along
the lines of :-
Graphics g = board.getGraphics();
board.paintComponent(g);
g.dispose();
to get the board to update after each successive move but I seem to be
having problems getting it working properly.
- If I use the above to repaint the background then all the buttons
disappear.
- If I use the above to repaint all the buttons it doesnt actually repaint
them, it just goes grey.
-If I try and repaint both, wherever moves are made by the computer you can
see the relevant square in the background but none of the other buttons are
drawn and its just grey instead.
After completeing the algorithm it all redraws as normal.
I just want everything to refresh as normal when each move by the computer
is made, can anyone help me out?
Thx in advance