accessing JComboBox selected item from another class



i am using a jcombobox (in its own class) as a popup from a
filechooser class when a user opens a file so that i can define in an
xml file the location and attribute for that file (the attribute from
the JComboBox). However i am unable to access the selectedItem from my
filechooser class. does anyone have any ideas on what im doing wrong?
here is a sample to help you understnad better.

//filechooser class once file is opened bring up combobox
comboboxclass combo = new comboboxclass();
combo.pack();
combo.setVisible(true);


//Enter is a Jbutton used to get selected index once selection is made
from popup combobox
if (e.getSource()==combo.Enter) {

//how to access these methods from filechooser class??
// combo.? to access instance of?
String newSelection = (String)aJComboBox.getSelectedItem();
currentitem = newSelection;
//close the JComboBox
System.exit(0);

Once im able to get the selected item i can then write an xml file
with the file location and the attribute im seeking from the combo
box.

Sorry if this seems confusing but if furhter clarification is needed i
will do what i can.

Fergie.
.


Quantcast