aspose file tools*
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
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

 
wood burning stoves
 
subject: display data from a JComboBox from one JFrame to another