• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
Just the other day, I was thinking ... about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic