aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Getting data from one frame into another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting data from one frame into another" Watch "Getting data from one frame into another" New topic
Author

Getting data from one frame into another

Raj Moti
Greenhorn

Joined: Nov 14, 2004
Posts: 4
Developers

I am having a frame say frame1 which is having a button and textfield.
On clicking a button which is on that frame1 I am displaying a frame say
frame2. Inside that frame2 I am having a text field and a button.
What I want is that when I will click on button of frame2
whatever there in the textfield of frame2 should get displayed in textfield
which is inside frame1.

With anticipatory thanks
Kriti Garg
Ranch Hand

Joined: Sep 13, 2004
Posts: 50
Hi,

pass your first frame refrence to ur second frame and create a get/set
methods in ur first frame,call these on action listener of second frame

OR

int count = container.getComponentCount();//frame1 component count
for (int q = 0; q < count; q++) {
if (container.getComponent(q)instanceof JTextField) {
String text= ((JTextField) container.getComponent(q)).getText;
////

set this text to frame 2 text field

}

}

Bbye
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting data from one frame into another