• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with displaying JLabels in new window?

 
John Corkrend
Ranch Hand
Posts: 51
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So here is my code in a summary, a button click from another class sends it here where it launches the new window.

How do I get the contents of stringFirst to display on the new window? Note: Any classes/textfields/buttons used in this code are in a seperate class that I don't is necessary to solve this issue.



 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the original window (JFrame ) is DataApplication, it won't work the way you're trying it.

1) the new window should be a JDialog - very rare to have 2 JFrames running around.
2) in the constructor of the dialog, pass a reference of the DataApplication instance to the dialog
3) set the various label texts to those from the instance passed
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic