harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "András Belicza" <icz...@gmail.com>
Subject Swing JList and JScrollPane
Date Sun, 10 Aug 2008 07:25:15 GMT
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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message