It's not a secret anymore!*
The moose likes Java in General and the fly likes String and Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "String and Array" Watch "String and Array" New topic

String and Array

henri henri
Ranch Hand

Joined: Oct 03, 2005
Posts: 115
I would like to be able to use the String containing the 26 letters of the alphabet in a JList. For now I have to put them in a String array. Is there any way of not having to declare a String array and using the String of letters in a JList?

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
One possibility is to create a class that implements the ListModel interface. For convenience, you might want to extend AbstractListModel since it provides default implementations for some of the methods. If you need more information, check the Swing trail in the Java Tutorial (see the link in my sig).

I hope this helps.


Java API Documentation
The Java Tutorial
henri henri
Ranch Hand

Joined: Oct 03, 2005
Posts: 115
Thanks, this will give me an opportunity to learn more about a JList
I agree. Here's the link:
subject: String and Array
Similar Threads
How to add a String array to JList?
Single interval selection in two lists
not able to get the items from JList
need help on JList
Can a string array member serve as an index number of another string array?