I use following code to fix size of JList/JTable
within a scroll pane. May work for you ..
JScrollPane jsp = new JScrollPane(m_list);
Dimension d = jsp.getPreferredSize();
d.height = 160;
d.width = 280;
jsp.setPreferredSize(d);
If the item exceeds the available width, scroll bars appear.
- Ajit
Johan Boulé wrote:
>
> Hi all,
> I have difficulties in trying to disable to automatic width resizement
> of a JList to the longest element it contains (if the longest element is
> represented by one character, the component automatically resizes itself
> its width and become really small).
> I have tried to override getMinimumSized, setMinimumSize, setSize,
> componentResized, to disallow the list to become to small, but it
> apparently doesn't do anything.
> Any help would be very appreciated.
> Johan
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing