Re: JScrollPane content sizing
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 May 2008 10:02:16 -0700
MRe wrote:
Hi,
<snip MRe></snip>What I want to do is have a JScrollPane containing a JPanel. The
JPanel should automatically size to the width of the JScrollPane's
viewport, and to the minimum height of the contents of the JPanel.
<snip Knute Johnson>
Remember that if you add a component to a ScrollPane constructor that</snip>
component is the ViewPort and will follow the rules of the
ScrollPaneLayout. It appears to be very similar the the center of a
BorderLayout in action.
I wrote a little test program that shows the size of a JPanel in a
JScrollPane. The JScrollPane only shows vertical scroll bars, never
horizontal. The JScrollPaneLayout will allow the JPanel to expand
larger than its preferred or maximum size (just as BorderLayout would).
It can never be smaller than the minimum width but if the JScrollPane
has been resized smaller than that minimum size some of the JPanel is
not visible.
This has fixed it for me, thank you very much for the sample code;
it's all seems quite easy once you know the secrets :)
Thanks again,
Kind regards,
Eliott
You are very welcome. When you have multiple components sometimes it is complicated to get just the right sizing, especially if you change the size of the top most container.
--
Knute Johnson
email s/knute/nospam/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
.
- References:
- JScrollPane content sizing
- From: MRe
- Re: JScrollPane content sizing
- From: Knute Johnson
- Re: JScrollPane content sizing
- From: MRe
- JScrollPane content sizing
- Prev by Date: Re: Painting Negative
- Next by Date: Re: Drop-Down-Menu in JToolbar
- Previous by thread: Re: JScrollPane content sizing
- Next by thread: Drop-Down-Menu in JToolbar
- Index(es):
Relevant Pages
|