Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

accessing JComboBox selected item from another class

Thread view: 
Fergie - 28 Apr 2005 19:14 GMT
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.
sanjay manohar - 30 Apr 2005 21:32 GMT
you need to post the code for comboboxclass.java


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.