Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Getting data from one frame into another

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic