Java BorderLayout stretch east
Asked Answered
B

3

5

Is it possible to make the east (or west) side of a BorderLayout to spread over the entire panel (include north/south)?

enter image description here

Brune answered 12/4, 2012 at 18:10 Comment(0)
F
7

Just remove West and East from this panel and create a new "parent" panel:

JPanel newPanel = new JPanel();
newPanel.setLayout(new BorderLayout());

newPanel.add(westernPanel, BorderLayout.WEST);
newPanel.add(yourOldPanel, BorderLayout.CENTER);
newPanel.add(eastenPanel, BorderLayout.EAST);
Flaunt answered 12/4, 2012 at 18:16 Comment(0)
H
2

not possible with single JPanel layed by BorderLayout

1) by using two JPanels, where NORTH, WEST, CENTER and SOUTH areas could be placed to the 1st JPanel (frame.add(1stPanel, BorderLayout.CENTER)) and plain 2nd JPanel to the frame.add(2ndPanel, BorderLayout.EAST),

2) you can use BoxLayout for area in the EAST from Container

3) little bit complicated could be use GridBagLayout or MigLayout (in this case)

Houdini answered 12/4, 2012 at 18:19 Comment(0)
T
1

Not directly, but you could have a border layout with no "east" nested within a layout that has your current East in the correct position... Make sense?

TL;DR: No.

Tobietobin answered 12/4, 2012 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.