I have a MyApplet class. In it, I declare 1 instance variables is: x = 13
and I have a button. I want then I clicked this button, a frame showed.
My frame have 1 textfield and 1 button. I want then I clicked this button, value of variable x show in textfield.
I tried created a method as getx() in MyApplet class:
public double getx() {
return x;
}
Then at MyFrame class, I tried to use x , but program show 1 error ( cannot find symbol x).
- None stop, I tried to declare a new object have type MyApplet
(MyApplet obj = new MyApplet) then use obj.getx() to take value of x variable. But result returned is 0.0
How do I must to take value of x variable from MyApplet class ?
Thanks
Eric