Java Swing Window will not appear

前端 未结 2 566
灰色年华
灰色年华 2021-01-16 03:41

Ok guys, here comes the humility. It\'s been a long time since I used Java Swing so I know there is some really obvious solution to this problem. What I\'m trying to do is g

相关标签:
2条回答
  • 2021-01-16 03:56

    Some tips:

    • Need to make visible your JFrame calling setVisible(true)

    • Instead of add(pane) you can use setContentPane(pane) replacing the default container used as content pane.

    • Don't forget to call pack() method when you finish adding components and before making your JFrame visible..

    • Create your GUI objects in the Event Dispatch Thread using SwingUtilities.invokeLater()

    • Avoid extend from JFrame unless you need to add some functionality. If that's not the case, use a JFrame variable or class member instead.

    0 讨论(0)
  • 2021-01-16 04:05

    You need to set it to visible. Use:

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