aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Help with displaying JLabels in new window? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help with displaying JLabels in new window?" Watch "Help with displaying JLabels in new window?" New topic

Help with displaying JLabels in new window?

John Corkrend
Ranch Hand

Joined: Oct 27, 2012
Posts: 51

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

Joined: Jun 09, 2003
Posts: 4632
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
I agree. Here's the link:
subject: Help with displaying JLabels in new window?
Similar Threads
Blank Frame or Panel
Help with actionlisteners on a button.
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI
Am I using repaint correctly?
How to close a window and open another one