Witam
Mam problem.
Chcę wykorzystać parametr k w podklasie LongTask Czy należy użyć dziedziczenia? Jakies krzaki wychodzą.
Zawęźony kod wygląda tak:
public class ProgressbarDemo extends JPanel
implements ActionListener {
....
public ProgressbarDemo() {
super(new BorderLayout());
task = new LongTask();
....
JTextField fatText= new JTextField("200",5);
JLabel fatLabel = new JLabel("tluszcze");
int k = Integer.parseInt(fatText.getText());
...
Metody
...
}
class LongTask {
private int lengthOfTask;
private int current , flourInt,fatInt;
private boolean done = false;
private boolean canceled = false;
private String statMessage;
public LongTask() {
lengthOfTask = 100;
}
...