Is it possible to make the east (or west) side of a BorderLayout to spread over the entire panel (include north/south)?
Java BorderLayout stretch east
Asked Answered
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);
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)
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.
© 2022 - 2024 — McMap. All rights reserved.