开发者

Components not displaying on JFrame time-to-time

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜