This is my simplified code: (how can I get this work?)
public class MyClass extends Applet implements ActionListener{ public void init(){ Button start = new Button("start"); Button stop = new Button("stop"); add(start); add(stop); start.addActionListener(this); stop.addActionListener(this); start.setActionCommand("start"); stop.setActionCommand("stop"); } public void actionPerformed(ActionEvent ae){ String action = ae.getActionCommand(); if(action.equals("start")){ // start inputstream while((len = is.read(buffer)) != -1){ // inputstream stuff } } else if(action.equals("stop")){ // stop while } } }
thanks!