I want to hide some elements after some time, so I call button.setVisible(false); But the button is still visible, event after calling
root.repaint();
button.repaint();
.
 
However the other direction is working: Calling button.setVisible(true); on an invisible button makes him visible.

1 answer

The problem was that setVisible(false); is not working, if the background color of the canvas is set to transparent.
Calling

setVisible(false);
context.clearRect(0, 0, canvas.width, canvas.height);
root.repaint();

is working.

#

Please login or Register to Submit Answer