hi there, I have used JComboBox in one of my programs, registered and implemented the ItemStateChangeListener for the same. It worked fine when I selected the combobox with mouse and keyboard. But when I try to select it through my program, it gets selected but the event doesnt get fired. Would n e body tell me where I went wrong? Thanks Sai
hi joe, Thanx for ur reply. The actual problem was, the event was not fired when the jcombobox was selected through my code. [ jCombobox.setSelected(true); //although the combox gets selected the event was not being fired. ] Basically, I wanted to fire the event without using the mouse & keyboard manually. It should be performed through my code itself. Hope u got me this time. thanks Sai
I'm just guessing here, but it sounds to me like you're trying to fire an event with code? I'm sure there is a way to do that, but - again, I'm guessing - it sounds like just setting the combo-box to a new value isn't going to generate an actionEvent or stateChange. I thought those events were actually 'fired' through the operating system, and then handed off to our programs to be handled. If that's the case, then just changing it in code doesn't fire the event. I'll bet there is a way to - using code - simulate an event to be fired, so your code can handle it just as if a user made the change. In fact, I'm pretty sure that can be done. Anyone know how?
-nothing important to say, but learnin' plenty-