Specify FlowLayout.RIGHT
for the panel holding the button, as shown here and here :
为按住按钮的面板指定FlowLayout.RIGHT
,如此处和此处所示:
JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
Then add p
to the SOUTH
or PAGE_END
area of a panel having BorderLayout
.
然后将p
添加到具有BorderLayout
的面板的SOUTH
或PAGE_END
区域中。
![图片](https://stackoom.com/link/aHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9paGU5eC5wbmc=)