passing value from jcombobox to other classes?
Hi
I have an Jcombobox with an ActionListener set up in a class called
"boxSelected", so that when the user clicks on the choice they're
after the result is sent to a jtext area.
public class boxlistener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if(e.getSource()==queryBox){
int selectedIndex =
queryBox.getSelectedIndex();
String boxSelected =
queryBox.getSelectedItem().toString();
System.out.println("Selected:
"+boxSelected);
String newline = "\n";
textArea.append(boxSelected + newline);
}
}
};
The class with the ActionListener, boxlistener, is actually nested
within another class, one called Editor.
My question is, can I pass this new string value, boxSelected, for use
in another class? I'm trying to create a new .java file with a
queryBuilder class and pass this string value for use with that class
there, so I can parse it into some queries.
I am still pretty new. Can anyone show me how to do this, or show me
what code I need? Any help would be really appreciated.
Regards,
John