wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: http://aspose.com/file-tools
subject: Help with displaying JLabels in new window?
Similar Threads
Am I using repaint correctly?
Help with actionlisteners on a button.
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI
How to close a window and open another one
Blank Frame or Panel