import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class Klahv2 extends Applet implements KeyListener{ int x=100, y=100; int taht; //setKeyCode; int kood; public Klahv2(){ init(); } public void init(){ addKeyListener(this); requestFocus(); } public void paint(Graphics g){ g.drawString((char)kood+"", 40, 60); //g.drawString(taht+"", 80, 60); } public boolean isFocusTraversable(){ return true; } public void keyPressed(KeyEvent e){ kood=e.getKeyCode(); repaint(); } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Klahv2()); f.setSize(200, 200); f.setVisible(true); } }