import java.awt.*; import java.applet.*; public class Painonappi extends Applet { int luku=0; Button tulos; public void init() { add ("Plus",new Button("Plus")); add ("Minus",new Button("Minus")); add ("Result",tulos = new Button("0")); } public boolean action(Event evt, Object arg) { if (evt.target instanceof Button) { if ("Plus".equals(arg)) luku++; else if ("Minus".equals(arg)) luku--; else luku=0; // Set the result as the button label tulos.setLabel(""+luku); } return true; } }