GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java-Work/Question70.java at master · Animesh-Ghosh/Java-Work Expand file tree/ Copy pathQuestion70.javaMore file actions 58 lines (55 loc) · 1.35 KB / Copy pathQuestion70.javaFile metadata and controls58 lines (55 loc) · 1.35 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 import java.awt.*; import java.applet.*; import java.awt.event.*; /* program to create an applet to handle keyboard events (message for F1, F2, F3, F4, F5 to be displayed) */ /* <applet code="Question70" height="100" width="300"> </applet> */ public class Question70 extends Applet implements KeyListener { String msg = ""; int X = 10, Y = 20; public void init () { addKeyListener (this); requestFocus (); } public void keyPressed (KeyEvent ke) { showStatus ("Key Down!"); int key = ke.getKeyCode (); switch (key) { case KeyEvent.VK_F1: msg += "<F1>"; break; case KeyEvent.VK_F2: msg += "<F2>"; break; case KeyEvent.VK_F3: msg += "<F3>"; break; case KeyEvent.VK_F4: msg += "<F4>"; break; case KeyEvent.VK_F5: msg += "<F5>"; break; case KeyEvent.VK_UP: msg += "<Up Arrow>"; break; case KeyEvent.VK_DOWN: msg += "<Down Arrow>"; break; case KeyEvent.VK_LEFT: msg += "<Left Arrow>"; break; case KeyEvent.VK_RIGHT: msg += "<Right Arrow>"; break; case KeyEvent.VK_PAGE_UP: msg += "<PgUp>"; break; case KeyEvent.VK_PAGE_DOWN: msg += "<PgDn>"; break; } repaint (); } 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); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |