How can I set distance between elements ordered vertically?

前端 未结 4 863
孤独总比滥情好
孤独总比滥情好 2021-01-17 13:03

I have code like that:

    JPanel myPanel = new JPanel();
    myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));

    JButton button = new JButton(         


        
4条回答
  •  情歌与酒
    2021-01-17 13:19

    Use the Box class as an invisible filler element. This is how Sun recommends you do it.

    BoxLayout tutorial.

提交回复
热议问题