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 ...

two muppets http://savepic.org/8470746.jpg

  • well, asked a question and at once found the answer. .repaint (): helped me. I will not refuse to read if someone adds something.) - Haart
  • one
    JButton is 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
  • I know, it's just a practice. The first thing that came to mind, realized. Found a "bug" - fix it. When it is done as planned, you can already think about optimization ...) - Haart

0