Is it possible to make the east (or west) side of a BorderLayout to spread over the entire panel (include north/south)?
Asked
Active
Viewed 4,531 times
3 Answers
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);

Stefan
- 12,108
- 5
- 47
- 66
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)

mKorbel
- 109,525
- 20
- 134
- 319
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.

Steve H.
- 6,912
- 2
- 30
- 49