Matt,
When you say the look to see if the JComboBox is selected, do you mean
see if a selection from the list has been chosen, or does the JComboBox
currently have the focus (ie has been clicked on last)?
If it's the first option, the best bet is to have a blank value in the
first selection, and in your code check...
if(comboBox.getSelectedIndex==0) {
//do nothing as first option chosen
} else {
//do something else
}
If it's the latter option, you would use comboBox.hasFocus()
Hope this is what you were looking for :)
webstar wrote:
Hi,
I know how to do an action listener with a button but now I want to try
something a bit harder. This is what I want to do...
When you user presses the JButton it looks at the JComboBox to see if it is
selected.
If it is, a sound is played.
If it isn't, nothing happens.
I'm not sure how to do this so if someone could give me a simple example or
send me on the write track I would very much appreciate it.
Thanks alot
Matt