English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Why does my program crash when I have two JComboBoxes with action listeners attached to them, and how do I differentiate between the JComboBoxes?

2007-02-26 23:45:58 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

any ActionListener can determine the source from the event object:

public void actionPerformed(ActionEvent ae){
Object src = ae.getSource();
if (src == combo1){
//do it's thing
}

If each action listener is only added to one combo box, then there isn't any sort of problem. You will need to tell us more if your problem is deeper than that.

2007-03-02 03:11:04 · answer #1 · answered by vincentgl 5 · 0 0

Please be clear as to when the program crashes whether while selecting the first or second one

2007-02-27 07:52:34 · answer #2 · answered by sundar r 2 · 0 0

fedest.com, questions and answers