Goodnight. I draw a line from the squares of jbutton on jpanel, when it is going to - I remove the line, jbutton - I release those above. Well, it turned out that the background of the deleted elements remains. Those. the elements themselves are removed, but the color remains. If you draw a figure on X, but higher, the background disappears. How can I update ... background or drawing, I do not even know how to formulate ...
W / s probably you can just remove the panel, create a new one and draw again ... but why reinvent the wheel ...
JButtonis the whole button, and not just a set of pixels in the form of a rectangle. I do not know about the final performance, but in itself it sounds strange and wrong: draw with buttons. With Swing almost did not work, but for sure there is a Canvas or its equivalent for drawing including the playing field. - Regent