This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Making a JComboBox uneditable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Making a JComboBox uneditable" Watch "Making a JComboBox uneditable" New topic

Making a JComboBox uneditable

Patrick Mugabe
Ranch Hand

Joined: Jan 08, 2002
Posts: 132
How can I make a JComboBox unEditable, I only know of setting a TextField to be uneditable by using setEditable(false).
Tamizh Selvan

Joined: Oct 10, 2003
Posts: 15
u can make ur jcombobox uneditable by calling its setEnabled(false).
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286

A JComboBox is unEditable by default. You can make it editable with the setEditable(boolean) command. If you are talking about enabled or disabled you can set that by the setEnabled(boolean) method. Setting a JComboBox enabled(false) will not allow the drop down to be activated. Editing means you can type in your own text into the text field of the Combo Box.

GenRocket - A Test Data Generation Platform
I agree. Here's the link:
subject: Making a JComboBox uneditable
Similar Threads
JCombobox with multiple columns
how to make specific jtable column uneditable?
How to persuade a JComboBox to change its selected item
GUI Questions: JTable and ComboBox
Combo box with a key listener- pls help