• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting data from one frame into another

 
Raj Moti
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic