accessing JComboBox selected item from another class
- From: KRISH58501@xxxxxxxxx (Fergie)
- Date: 28 Apr 2005 11:14:53 -0700
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.
.
- Follow-Ups:
- Re: accessing JComboBox selected item from another class
- From: sanjay manohar
- Re: accessing JComboBox selected item from another class
- Prev by Date: Re: newbie question
- Next by Date: OutOfMemory on Sun Java 1.4.2 on Linux
- Previous by thread: Looking for a book
- Next by thread: Re: accessing JComboBox selected item from another class
- Index(es):