How to correct/center GridLayout using standard Java layout managers?

后端 未结 3 1034
深忆病人
深忆病人 2020-12-11 23:32

The below code represents the problem. Since I have heights of the north and south panels set the rest of it goes to the center panel using GridLayout. I think that since it

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

    How to make sure that when the GridLayout is not taking the whole space it is at least centered?

    JPanel wrapper = new JPanel( new GridBagLayout() );
    wrapper.add( centerP );
    contentPane.add(wrapper, BorderLayout.CENTER);  
    //contentPane.add(centerP, BorderLayout.CENTER); 
    

提交回复
热议问题