Results 1 to 4 of 4
- 08-06-2009, 04:29 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
Passing data from one JFrame to another JFrame
Hi, I'm new to Java and completely out of conception how to solve my problem.
The trouble is that I have two JFrames.
JFrame1 has a JLabel and a JButton1.
JFrame2 has a JTextField and a JButton2
The interaction between the frames is as following:
When the JButton1 on JFrame1 is pressed the JFrame2 shows up. User enters some text in the JTextFields and then clicks the JButton2 on JFrame2. Then the JFrame2 disappears and the Label on JFrame1 is set with the text that has been entered in JTextField that was on JFrame2.
How can I do that?
- 08-06-2009, 04:33 PM #2
First of all JFrame2 should be a JDialog as it is a child of JFrame1. The JDialog has an owner, which in your case is JFrame1. So when closing the JDialog you can pass information.
see this tutorial: How to Make Dialogs (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)
- 08-06-2009, 04:48 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
Thank u for the answer.
What if I want to design a more sofisticated dialog window for, say, a personal details questionnaire with various visual components such as JFormattedTextFields, JSpinners, JComboBoxes?
-
Similar Threads
-
How to make a Jframe un-focusable when another Jframe is active?
By Robert_85 in forum Advanced JavaReplies: 4Last Post: 04-22-2009, 11:02 PM -
Returning data from a JFrame/JDialog?!
By Joe2003 in forum AWT / SwingReplies: 6Last Post: 01-08-2009, 12:14 AM -
help in JFrame
By kirtesh4u in forum AWT / SwingReplies: 1Last Post: 11-18-2008, 12:26 AM -
jframe
By amith in forum AWT / SwingReplies: 1Last Post: 05-15-2008, 10:03 AM -
Passing data from one JFrame to another
By abhiN in forum New To JavaReplies: 2Last Post: 03-28-2008, 05:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks