Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InterActing InternalFrames in SWING - MDI Application

 
Manoj Amrutkar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one Swing-MDI Application, where the structure is Outer Frame containing JDesktopPane, Which can open several internalframes.

Now i have two internalframes say IF1 and IF2.

IF1 has two textfields say tf1 and tf2, where as IF2 has third field say tf3. These IF1 and IF2 are interrelated by calculations as follows,



now suppose i have both the frames open simultaniously. And if i enters some value in tf1 and/or tf2 from IF1, The resulted sum should be reflected in tf3 of IF2.

How can i acheive above scenario.

Thanks in advance!

Manoj
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
depends on when you want the calculation done

a DocumentListener if you want immediate
e.g. tf2 has 9.00, and you want to enter 123.45 into tf1
tf3 will display (with each keystroke)
10.00
21.00
132.00
132.40
132.45

if you want the calc after entering the number, an actionListener for 'enter'
or for a separate button 'calculate'
 
Manoj Amrutkar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how exactly to get the reference of second frame?
Some code sample will be really helpfull.

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic