Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: JList customized with TreeSet

Thread Tools

Re: JList customized with TreeSet

Sandip Chitale
Posts: n/a
You need to look into:

Look at the example at the top of JList javadoc. Specifically look at the
MyCellRenderer example:

also see

"Oni" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) om...
> Hi there!
> I have a TreeSet of TreeSets which I need to display in a JList
> (preferably).
> The elements of the TreeSets are Strings.
> I need to display the JList with TreeSet.size() cells and in every
> cell I want to have the representation of the every TreeSet by
> drawing a rectangle(filled with different color) for every element of
> the current TreeSet.
> In addition, I would like to print the Strings on top of this
> rectangles and the selection event for the list as well.
> I am trying to sort this out with DefaultListModel and
> ListCellRenderer, but I really don't know exactly how to use them to
> get the desired outcome.
> I am not necessarly sticked to JList, but I want this visual
> representation with rectangles in a scrollpane anyway.
> I would really appreciate a lot any idea, suggestions or even pieces
> of code.
> Many thanks in advance.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
HashSet and TreeSet Ye Dafeng Java 4 11-16-2006 03:00 AM
TreeSet bug? jacksu Java 2 06-15-2006 09:47 PM
Re: correct use of TreeSet Stefan Ram Java 2 02-26-2006 03:47 PM
Why would an add() in a TreeSet subclass fail? Rhino Java 17 02-24-2005 05:09 AM
TreeSet size() Problem Rhino Java 2 02-22-2005 04:49 PM