Java Swing: JPanel only adds components when JFrame window is maximized or it's size changed

前端 未结 1 1775
我寻月下人不归
我寻月下人不归 2021-01-27 20:00

I have a Java program that creates a JFrame, a JPanel, and several JTextAreas. I set the text of the JTextAreas and then add them to the JPanel. When the program loads, I only s

相关标签:
1条回答
  • 2021-01-27 20:57

    My guess: You need to call setVisible(true) on the JFrame after adding all components to it.

    Next time, or this time if this doesn't answer your question, please post pertinent code. We're terrible at reading minds or guessing at code not shown. Please check out the Jon Skeet blog: Asking the Perfect Question. It will give you great suggestions on how to create better more complete questions and thus get better answers.

    0 讨论(0)
提交回复
热议问题