The Artima Developer Community
Sponsored Link

Java Answers Forum
JList in JTable

4 replies on 1 page. Most recent reply: Nov 5, 2003 12:56 PM by s

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Maria

Posts: 4
Nickname: rilla24
Registered: Apr, 2002

JList in JTable Posted: Nov 4, 2003 7:23 AM
Reply to this message Reply
Advertisement
Hi.
I want to use JList in JTable, so i can selected mutiple items. But CellEditor don't take JList. Any tips?


Vijay

Posts: 1
Nickname: vjai
Registered: Nov, 2003

Re: JList in JTable Posted: Nov 4, 2003 9:15 AM
Reply to this message Reply
hi

sdinesh79

Posts: 7
Nickname: sdinesh79
Registered: Sep, 2003

Re: JList in JTable Posted: Nov 4, 2003 10:26 PM
Reply to this message Reply
Adding the following line wud help

list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);


Refer to the following url

http://java.sun.com/docs/books/tutorial/uiswing/components/list.html

or to this

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/ListSelectionModel.html

Maria

Posts: 4
Nickname: rilla24
Registered: Apr, 2002

Re: JList in JTable Posted: Nov 5, 2003 1:26 AM
Reply to this message Reply
Thanks, but I know to use JList, the problem is to use it in JTable. I now use JComboBox to edit the value in a cell in JTable. But then i can't make multiple selections. And "table.setCellEditor(new DefaultCellEditor(aJList));" give this error from the compiler
"cannot resolve symbol: constructor DefaultCellEditor (javax.swing.JList)in class javax.swing.DefaultCellEditor"

s

Posts: 23
Nickname: codemonkey
Registered: Nov, 2003

Re: JList in JTable Posted: Nov 5, 2003 12:56 PM
Reply to this message Reply
ListSelectionModel selModel = yourTable.getSelectionModel();
selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

Flat View: This topic has 4 replies on 1 page
Topic: help with game Previous Topic   Next Topic Topic: com.sun.java.swing.plaf.windows.*

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use