Java 8 updated

 avatar
Rohit143
java
2 years ago
981 B
24
Indexable
Never
// <applet code=practical10 width=400 height=100></applet>
import java.awt.*;
import java.applet.*;

import java.awt.event.*;


public class practical10 extends Applet implements KeyListener {
    public void init() {
        addKeyListener(this);
    }
    public void keyPressed(KeyEvent e) {
        showStatus("Key pressed ...");
        if(e.getKeyCode() ==38){
            keyUp();
        }
        if(e.getKeyCode() ==40){
            keyDown();
        }
    }
    public void keyUp() {
        showStatus("Up key is pressed ...");
        
    }
    public void keyDown() {
        showStatus("Down key is pressed ...");
        
    }
    public void keyReleased(KeyEvent e) {
        showStatus("Key Released ...");
        
    }
    public void keyTyped(KeyEvent e) {
        showStatus("Key Typed ...");
    }
    public void paint(Graphics g) {

        g.drawString("by Rohit Nanadagawali", 10, 20);
        
    }

    
}