Sometimes Jcomponents are not visible until mouse hovering

74 views Asked by At
JPanel panel = new JPanel();
panel.setLayout(null);

JButton button = new JButton();

button.setSize(30, 30);
button.setLocation(30, 30);

panel.add(button);

I dont know but sometimes button appeares itself (as i understand it has to) and sometimes button does not appear until mouse hovers it. Can you explain please is it bug or i do something wrong.

1

There are 1 answers

0
Ivan Gorbunov On

The method

repaint()

is a solution