Change contentpane of Frame after button clicked

后端 未结 3 1704
不思量自难忘°
不思量自难忘° 2020-12-19 06:41

I want to be able to set a JFrame\'s contentpane after a button inside one of that frame\'s JPanels has been clicked.

My architecture consists of a controller which

3条回答
  •  鱼传尺愫
    2020-12-19 07:18

    Whenever you change a frame's containment hierarchy, you have to call pack().

    From the docs:

    Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. [...] The Window will be validated after the preferredSize is calculated.

提交回复
热议问题