I have a ComboBox and a Button("Submit");
I want to write the content of the ComboBox to a File when I hit submit;
I can do that with TextFields (a simple get.Text, BufferedWriter and an ActionListener for the Button);
To do it with ComboBox I need an extra ActionListener to "listen" to the SelectedItem in my ComboBox;
How do I pass the SelectedItem from the (ComboBox) ActionListener to the (Button) ActionListener so it can be written in my file?
I'm probably making other little mistakes but the two ActionListener(s) using the same variable -the item selected- is what's bothering me.
I tried to find solutions elsewhere but no luck.
I guess here I can't pass the SelectedItem to the other ActionListener as an argument and I must implement the ActionListener for the ComboBox,otherwise if I just do a simple combolist.getSelectedItem it returns null.