[ACCEPTED]-java swing dynamically adding components-dynamic
Accepted answer
You need to call revalidate
after adding (or removing) components:
rightPanel.add(label);
rightPanel.revalidate();
should 1 do the trick.
call
rightPanel.revalidate();
rightPanel.repaint();
after adding
0
just add this line after you add the label
rightPanel.updateUI();
when 2 you add any component at runtime you need 1 to update the ui using this method
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.