Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display data from a JComboBox from one JFrame to another

 
Marwen Ben
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic