Write a java Applet program to perform KeyBoard Event



import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="Key" width=300 height=400>
</applet>
*/
public class Key extends Applet
implements KeyListener
{
int X=20,Y=30;
String msg="KeyEvents--->";
public void init()
{
addKeyListener(this);
requestFocus();
setBackground(Color.green);
setForeground(Color.blue);
}
public void keyPressed(KeyEvent k)
{
showStatus("KeyDown");
int key=k.getKeyCode();
switch(key)
{
case KeyEvent.VK_UP:
showStatus("Move to Up");
break;
case KeyEvent.VK_DOWN:
showStatus("Move to Down");
break;
case KeyEvent.VK_LEFT:
showStatus("Move to Left");
break;
case KeyEvent.VK_RIGHT:
showStatus("Move to Right");
break;
case KeyEvent.VK_F1:
showStatus("F1");
break;
case KeyEvent.VK_F2:
showStatus("F2");
break;
case KeyEvent.VK_F3:
showStatus("F3");
break;
case KeyEvent.VK_F4:
showStatus("F4");
break;
case KeyEvent.VK_F5:
showStatus("F5");
break;
}
repaint();
}
public void keyReleased(KeyEvent k)
{
showStatus("Key Up");
}
public void keyTyped(KeyEvent k)
{
msg+=k.getKeyChar();
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,X,Y);
}
}



**********************************************
HTML

<html>
<applet code="Key.class" width="800" height="500">
</applet>
</html>


For more details about How to Earn Money Online please visit

http://codetherush.in/

College Projects with source code (PHP, .NET, JAVA, Visual Basic)


Pharmacy Management System in PHP and MySQL with Source Code


2018 Top WordPress Plugins for Business Websites


Top 10 Best Photo Editing Apps For Android


Best 2018 Android Hacking Apps


30 Best Free WordPress Blog Themes for 2017


Online Loan Management System


Car Rental System Using PHP


Online Jewellery Shopping System Php Project with source code


Online time table generation system in PHP


Online Examination System In PHP


PHP Website with DataBase As MySql


18 Ways to Earn Money Online from Home Without Investment


Online Survey Jobs: Earn from 20 Best Paid Survey Sites


Get Paid to Take Online Surveys for Money with 21 Best Sites


Top 10 Captcha Entry Job Sites


Best Get Paid to Offer & GPT Sites


Get Paid to Read & Click Ads from Best PTC Sites


How To Restore Your WordPress Website Backup On Local Server Using WAMP


Online Shopping System Using PHP and MySQL


Email server using PHP and MySQL


Hotel Reservation System In PHP


social media platforms Project In PHP


Crime Reporting System Project In PHP


Gmail Outlook Settings In Outlook 2016


Airlines Reservation System Java Project


Mail Server in PHP And MySQL


Online Examination System in PHP and MySQL


Student Information System using Vb and SQL


Payroll Management System In VB and SQL


Exam Seating Management System


Automation Inventory System in VB and SQL Server


School Management System

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete

Powered by Blogger.