开发者

Components not displaying on JFrame time-to-time

开发者 https://www.devze.com 2023-01-26 18:58 出处:网络
I have a JFrame Gridlayout with components like buttons, JTextfield开发者_如何学Pythons, JLabels.

I have a JFrame Gridlayout with components like buttons, JTextfield开发者_如何学Pythons, JLabels.

Sometimes when I execute the file, I see an empty frame. So I have to maximize the screen, the components come back. and then when I go back to normal window, the components are still visible.

Sometimes when I execute the file, I see the components right away. As they should be.

Can anyone explain this phenomena?


Sounds like the items aren't getting painted or repainted at the correct time. Make sure you are not making the frame visible first and then adding components, or if you are making sure you revalidate() or repaint() after making changes to something that you have already made visible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号