简体   繁体   中英

How to add more than one button in Border Layout

This is the Picture of Border Layout 在此处输入图片说明

I want to add Three buttons at Page_End. is it possible ? and how ?

Note:I cant change layout. else i have to change so much code.

  • Add a JPanel (or Panel) on PAGE_END
  • Use some layout on it (again BorderLayout for example).
  • Add some other components (like buttons) on that JPanel.

** Sample code as requested **

JPanel panel = new JPanel();
JButton button1 = new JButton("Bottom Left");
JButton button2 = new JButton("Bottom Right");
panel.setLayout(new BorderLayout());
panel.add(button1, BorderLayout.LINE_START);
panel.add(button2, BorderLayout.LINE_END);

pane.add(panel, BorderLayout.LINE_END);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM