• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reference Applet from Dialog

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created an instance of a Frame from an an applet,
and then created a Dialog from the Frame, but how do I access variables that are in the main applet class from the Dialog?
Since the Applet was not really instantiated with "new", what is the syntax to reference it from the Dialog?
Thanks!
Drew
 
Rakesh Ray
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pass "this" to your Frame!!!
class TheApplet extends Applet
{
public int xxxx;
Frame fm = new Frame(this, ...);
}

class Frame
{
Frame( TheApplet myApplet)
{
myApplet.xxxx =5
}
}
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!