However, when the lists have items. The widths of the JLists become
dependent upon the preferred size returned by the cell renderer. This makes
my lists layout horribly unbalanced when there is actual data in them.
As I understand it my options are few...
1) I can specify a fixed cell width / height, which would be in appropriate
because the cell contents aren't known at compile time.
2) I can specify a prototype cell value. Which is just an indirect way of
fixing the width and height to the values needed by the prototype. This also
isn't satisfactory, for the same reasons.
3) I can have my viewport not track the width of the JList (i think, this is
a possible solution) but this would prevent horizontal scroll bars from
appearing (i think)
Is there an *easy* way to make the JList *not* resize based upon the
renderer's contents. I'd like my layout manager to layout my lists, and then
have that size be used by the JList, until the window resizes and the layout
manager lays out the widgets again.
I appreciate any suggestions you might have.
Thanks,
John Schank
John Schank wrote:
[Your description]
> However, when the lists have items. The widths of the JLists become
> dependent upon the preferred size returned by the cell renderer. This makes
> my lists layout horribly unbalanced when there is actual data in them.
> As I understand it my options are few...
> 1) I can specify a fixed cell width / height, which would be in appropriate
> because the cell contents aren't known at compile time.
> 2) I can specify a prototype cell value. Which is just an indirect way of
> fixing the width and height to the values needed by the prototype. This also
> isn't satisfactory, for the same reasons.
> 3) I can have my viewport not track the width of the JList (i think, this is
> a possible solution) but this would prevent horizontal scroll bars from
> appearing (i think)
> Is there an *easy* way to make the JList *not* resize based upon the
> renderer's contents. I'd like my layout manager to layout my lists, and then
> have that size be used by the JList, until the window resizes and the layout
> manager lays out the widgets again.
You can set the preferred size of the JScrollPane explicitly to
restrict the size, for instance. Also, a surrounding panel with
a GridLayout makes all components inside equal in size. However,
I don't think that this is a preferrable solution for JLists.
Linda
--
(=)
/ li...@jalice.ch - http://www.jalice.net
(=)
/ l.ra...@hswzfh.ch - http://www.hswzfh.ch
(=)