JPanel grows too wide - how to stop it?

  • Thread starter Dobieslaw Wroblewski
  • Start date
D

Dobieslaw Wroblewski

Hello,

I have two panels (JPanel) with etched borders, side by side. The left panel
p is growing far too wide after adding a few buttons to it. It looks bad and
I would like its width to stay as compact as possible. I tried:

p.setMaximumSize(p.getMinimumSize());

....after adding the buttons, and it looks better, but this does not solve
the problem.
The problem is that both panels are on a parent panel (BoxLayout, LINE_AXIS)
which is placed in the bottom of the application frame, divided from the
rest using a horizontal splitter. If I move the splitter up, the right
panel's height grows as expected, but the p retains its size, of course.

How to set maximum width only? Or maybe I should use different layout for
the parent panel?

DW.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top