File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two ActionListeners

 
Jhon Calado
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I'm having a little problem with a GUI :

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.

Thank you in advance.





 
Jhon Calado
Greenhorn
Posts: 9
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get it now.Problem solved.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic