Java Swing JList -


I am trying to create a JList to display the content of an array. The array itself is not an array of wires, however, but an array of objects.

Is it possible to use the same array of objects as a parameter in my Zelist (if the objects are given a toString method)?

Thank you.

Yes it is.

A list uses an object called a cell renderer so that it can display each of its items. The default cell renderer knows how to display the strings and icons and it displays the object by applying toString .

See:


Comments

Popular posts from this blog

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -