Nelson Tatius
Nelson Tatius

Reputation: 8043

Analog of TableLayoutPanel in Swing

In .NET if I want to create window with two panels on the sides, I can add the TableLayoutPanel on the window, and specify three columns: fixed sized, auto-sized, and fixed-sized again. Both panels will save their size in a case of window resizing.

How can I do this with Swing?

Upvotes: 2

Views: 680

Answers (2)

Robin
Robin

Reputation: 36611

Looks like a simple BorderLayout will do the trick. It allows to specify up to 5 panels (PAGE_START, PAGE_END, LINE_START, CENTER, LINE_END) but you will only need the last 3 ones. All extra available size goes to the CENTER area, meaning the size of your side panels remains constant.

Just for reference: the Visual guide to layout managers is always a good starting point if you are looking for a LayoutManager with certain properties

Upvotes: 4

dlaxar
dlaxar

Reputation: 549

There is a lib called Mig-Layout (http://www.miglayout.com/) that can do this. You probably also could do this using internal Layouts, but I actually always use Mig-Layout even though the lib is pretty big.

Upvotes: 2

Related Questions