Why there is no setEditable(boolean b) for JList?

R

RC

There is setEditable(boolean b) for JComboBox, but not
for JList, why?

How do I make JList editable?

Thanks!
 
R

Rhino

RC said:
There is setEditable(boolean b) for JComboBox, but not
for JList, why?

How do I make JList editable?
You can't make a JList editable. A JComboBox is basically an editable JList.
If you want an editable list, you need to use a JComboBox (or write a custom
class that has the desired functionality). Of course, you need to make sure
you use an _editable_ combo box. See this article from the Java Tutorial for
instructions on how to use editable combo boxes:
http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html
 
O

Oliver Wong

RC said:
There is setEditable(boolean b) for JComboBox, but not
for JList, why?

How do I make JList editable?

What would it mean for an JList to be editable? I.e. how do you imagine
it behaving? Perhaps we can tell you how to implement it once we have a
better idea of what you wanted.

- Oliver
 
B

Bent C Dalager

There is setEditable(boolean b) for JComboBox, but not
for JList, why?

How do I make JList editable?

You don't.

If you want an editable list, you could use a one-column JTable
instead.

Cheers
Bent D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top