Hello.
Im a newbie and i really hope you guys can teach me a thing or two.
I just want to access, values of certain variables, from the superclass. But my constructor is giving me issue:
public class Calculator extends SwingFrame {
SwingFrame testingobj = null;
public Calculator(SwingFrame frame) {
this.testingobj = frame;
}
public int test = 0;
void someMethod(){
}
}
The SwingFrame Class:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Calculator callthemethod = new Calculator(this);
callthemethod.someMethod();
This works perfectly. It will call the method, every time i press the JButton.
Here is the issue:
public class Mastering extends Calculator {
public Mastering(SwingFrame frame) {
super(frame);
}
}
So now my Mastering class is subclass of Calculator and will inherit the constructor.
But what if i want to access, variables from the Calculator class?
I tryed:
Calculator test = new Calculator();
It tells me, that: Calculator in class Calculator, cannot be applied to given types:
required: SwingFrame.
And now, i dont know how to call variables, from the Calculator class(the Calculator test = new Calculator(); is the only way, i know how to access variables from other the class).
Please help me, i just kept looking for solutions for hours and days. But im stuck.
Thank you very much.