Jump to content
  • Advertisement
Sign in to follow this  
kagey

[java] A dynamically added swing component will not draw

This topic is 4548 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey all, here is my setup: I have a JPanel (j1) inside a JScrollPane. I am dynamically adding JPanels to j1, but they are not getting drawn right away. I have to force a relayout by resizing the window in order for the changes (added new JPanel) to j1 to be shown. If i call a doLayout() on j1 right after I add a JPanel (j2) to it, only the top level j2 elements are drawn (border, background) but not any children components (eg a label with text). If i resize the window, children components are drawn correctly. What gives? how can i force j2 to be displayed right away? TIA

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!