Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JList or JTable

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I currently have a JList with a list of names. I want to be able to edit/add the names. So I have 2 options that I know of:
1. Use a JButton and when clicked prompt user for a new name. Use a JButton for edit, and prompt the user to edit the selected name in the List.
2. Use a single column JTable and edit/add the names directly.
Now for my question. Is there a way to edit an item in a JList in the same manner you can edit data in a JTable, direclty in the containing Cell?
If not, I will probably end up using a JTable. But am just curious about the latter.
Thanks.
[ June 21, 2002: Message edited by: Gregg Bolinger ]
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is an example of an editable list:
http://www2.gol.com/users/tame/swing/examples/JTableExamples3.html
cheers
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. However, I don't believe that is an Editable JList. I believe that is a 1 column JTable that is actually editable. The JList on the left is updated by the JTable.
But thanks anyway.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic