Re: automatically maximize JTable?
- From: Pete Barrett <petebarrett@xxxxxxxx>
- Date: Mon, 27 Jun 2005 18:40:25 +0100
On 27 Jun 2005 06:59:10 -0700, matomira@xxxxxxx wrote:
>I have a JTable inside a JScrollPanel in the CENTER of a Panel with a
>BorderLayout (at the EAST there are some buttons, and the panel is
>inside some other panel/box).
>
>How can I do to get this scollpanel/table combo to fit all the
>available space in the panel, besides that taken up by the buttons?
>
>I found the call setPreferredScrollableViewportSize() can be used to do
>this resizing, but I don't know from where this can be called, and how
>one would compute this preferred size.
>
Generally, I find it best to leave the resizing to the LayoutManager,
though occasionally it's necessary to use
x.setMaximumSize(x.getPreferredSize()) to stop something being resized
beyond what it needs. BorderLayout is supposed to (and I've found it
does) give the CENTER component all the room not taken up by the other
components. Where is the space you want it to expand into? Top,
bottom, east or west?
>I find Swing to be a really primitive toolkit when it comes to layout.
Pete Barrett
.
- References:
- automatically maximize JTable?
- From: matomira
- automatically maximize JTable?
- Prev by Date: Re: Synth XML file placement
- Next by Date: Controlling JComboBox size in JTable cell
- Previous by thread: Re: automatically maximize JTable?
- Next by thread: Re: automatically maximize JTable?
- Index(es):