I have this code
import javax.swing.*
import java.util.TimerTask;
public class myClass extends TimerTask{
JSlider j;
// constructor
public myClass (JSlider j) {
this.j = j;
... do stuff e.g. use "j"...
}
}
How do I now call myClass and pass it a JSlider value?
JSlider slider0;
new MyClass(slider0);
Is all of the above the appropiate way to do it?
Provided your class looks like this:
Then your instantiation code should look somewhat like this: