Home » » KeyListener in Java Program

KeyListener in Java Program

KeyListener in Java Program

KeyListener in Java Program

KeyListener in Java Program

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class siva extends Applet implements keylistener
{
String msg="";
int x=10,y=20;
public void init()
{
addKeyListener(this);
}
public void KeyPressed(KeyEvent ke)
{
showStatus("Keydown");
}
public void KeyReleased(KeyEvent ke)
{
showStatus("Key up");
}
public void KeyTyped(KeyEvent ke)
{
msg+=ke.getKeyChar();
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg x,y);
}
}

//<applet code="siva.class" width=300 height=300></applet>

0 coment�rios:

Post a Comment

Link you don't want to vouch for Read more: https://html.com/seo/#ixzz5zVltiZ5g