• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String and Array

 
henri henri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Layne
 
henri henri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, this will give me an opportunity to learn more about a JList
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic