harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sian January" <sianjanu...@googlemail.com>
Subject Re: Swing JList and JScrollPane
Date Mon, 11 Aug 2008 09:27:30 GMT
Hi András,

I'm not very familiar with Swing, but have you tried calling repaint and/or
revalidate on the JScrollPane as well as on the JList?

Regards,

Sian


On 10/08/2008, András Belicza <iczaaa@gmail.com> wrote:
>
> Hi!
>
> I have a question regarding to JList inside of a JScrollPane.
>
> *Situation:
> *I have a JList component inside a JScrollPane, which is added to a panel
> of
> a frame.
> The model of the list is a DefaultListModel, which contains objects having
> toString() overridden to produce the text visible in the JList.
>
> I change one of the objects of the list, and its toString() method will
> return a much longer string which does not fit in the size of the list. I
> even call the JList's revalidate() and repaint() methods.
> *
> Expected behaviour:
> *The JScrollPane should display the scrollbars giving the possibility to
> scroll to see the long name of the item.
>
> *What happens:*
> The string returned by toString() is truncated, and containing a "..." in
> the end signing that the string is longer than what we can see.
> And now if I add a new element to the list (or to its model), then the
> scrollbars will appear and the truncated string ending with "..." is
> displayed now correctly, as the whole string.
>
> Am I doing something wrong? Do I have to call something to tell the JList
> or
> JScrollPane not to truncate the string but to display the scrollbars?
>
> Thanks,
>    András
>



-- 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message