The moose likes Beginning Java and the fly likes JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "JComboBox" Watch "JComboBox" New topic
Author

JComboBox

Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
I am using a Jcombobox with 9 options to choose from. When a selection is made an event is fired, things happen, and I want to change the text that is displayed inside the combobox. Is there an easy way to do this?
The closest I could come was to totally replace the comboboxmodel that the combobox was using. This in turn reset the selected index and fired an event that I didn't want. Is there a way to turn off events for the combobox? Component(a grandparent of JComboBox) provides a disableEvent(long eventsToDisable) method, but I can't figure out what form the eventsToDisable parameter should take. I haven't seen anything about it in the docs.
Is this the only way to change that text? Is there somewhere I can find out about the eventsToDisable parameter?
Thanks,
Chris
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 18130

I'm moving this thread to the Swing / AWT forum ...
 
IntelliJ Java IDE
 
subject: JComboBox
 
Threads others viewed
Find current line number in JTextField
different JComboBoxes as editors on multiple JTable rows
JComboBox
cannot find symbol
JComboBox event triggers another JComboBox
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture