Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList class  RSS feed

 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see it takes an array of objects as a parameter. Does anyone know how I can use something like \t to format that text properly? I tried formatting the items with \t and it isn't working.
 
Tom Purl
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please post some of the code that you tried?
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating the list:

Here is the method that creates a new Student, the returned Object array is passed to the JList as the new data source. Right now I've just added spaces between each attribute, but I really want to have tabs.
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use a JTable.
Grandi
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree. A JTable would be the best approach. Any reason you don't want to use a JTable? Or had you just not tried that yet?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also put that a toString() on Student and use it. After all, Student is an Object.
[ June 19, 2003: Message edited by: Paul Stevens ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!