Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reference Applet from Dialog  RSS feed

 
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
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!