This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes display data from a JComboBox from one JFrame to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "display data from a JComboBox from one JFrame to another" Watch "display data from a JComboBox from one JFrame to another" New topic
Author

display data from a JComboBox from one JFrame to another

Marwen Ben
Greenhorn

Joined: Apr 21, 2012
Posts: 3
Hello,

I have two windows, one where the user selected an element in a JComboBox and the other where I want to retrieve the value of this JComboBox and display it in a label.
The problem is: how to retrieve the value of the text in the JComboBox and send it to my second window?

I have two class in the same package :


fenetre1.java





fenetre2.java




it does not display anything in the JLabel
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
a lot depends on how the 2nd frame opens - starts at same time as 1st frame?, opens as a result of some action on frame1? etc

if it opens from frame1, and it opens just to get some info for frame1, frame2 should be a JDialog.

it would go something like this

 
 
subject: display data from a JComboBox from one JFrame to another
 
Similar Threads
how to store datecombobox in an arraylist of type combobox
Referencing swing components from ActionEvent
Problem with gridbaglayout in JPanel
JComboBox - rookie question
getActionCommand() this is not working in code