import java.awt.*; import java.applet.*; public class KiinteaTeksti extends Applet { TextField lahde, kohde; String sana="hotjava"; Label teksti; public void init() { teksti = new Label("Try to get the word hotjava right! ",Label.LEFT); add (teksti); teksti = new Label("Press Ready"); add (teksti); add(lahde = new TextField(10)); add(kohde = new TextField(10)); add(new Button("Ready")); lahde.setText(sana); kohde.setEchoCharacter('*'); } public boolean action(Event evt, Object arg) { if (evt.target instanceof Button) { if (lahde.getText().equals(kohde.getText())) lahde.setText("right"); } return true; } }