I'm using Textpad and basically i just want to get the keyboard to work, nothing to crazy. This is what I have so far and it comes out with two errors.
import javax.swing.*;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.*;
public class ComputerClub
{
KeyBoard Handler = new KeyBoard();
public void init()
{
this.addKeyListener(Handler);
}
public static void main ( String [] args )
{
System.out.println ("Sample text");
}
public class Keyboard implements KeyListener
{
public void keyTyped(KeyEvent event)
{
char a = 'a';
char b = 'b';
char c = 'c';
char d = 'd';
char e = 'e';
char f = 'f';
char g = 'g';
char h = 'h';
char i = 'i';
char j = 'j';
char k = 'k';
char l = 'l';
char m = 'm';
char n = 'n';
char o = 'o';
char p = 'p';
char q = 'q';
char r = 'r';
char s = 's';
char t = 't';
char u = 'u';
char v = 'v';
char w = 'w';
char x = 'x';
char y = 'y';
char z = 'z';
if(a == event.getKeyChar())
System.out.println("This is the A key");
if(b == event.getKeyChar())
System.out.println("This is the B key");
if(c == event.getKeyChar())
System.out.println("This is the C key");
if(d == event.getKeyChar())
System.out.println("This is the D key");
if(e == event.getKeyChar())
System.out.println("This is the E key");
if(f == event.getKeyChar())
System.out.println("This is the F key");
if(g == event.getKeyChar())
System.out.println("This is the G key");
if(h == event.getKeyChar())
System.out.println("This is the H key");
if(i == event.getKeyChar())
System.out.println("This is the I key");
if(j == event.getKeyChar())
System.out.println("This is the J key");
if(k == event.getKeyChar())
System.out.println("This is the K key");
if(l == event.getKeyChar())
System.out.println("This is the L key");
if(m == event.getKeyChar())
System.out.println("This is the M key");
if(n == event.getKeyChar())
System.out.println("This is the N key");
if(o == event.getKeyChar())
System.out.println("This is the O key");
if(p == event.getKeyChar())
System.out.println("This is the P key");
if(q == event.getKeyChar())
System.out.println("This is the Q key");
if(r == event.getKeyChar())
System.out.println("This is the R key");
if(s == event.getKeyChar())
System.out.println("This is the S key");
if(t == event.getKeyChar())
System.out.println("This is the T key");
if(u == event.getKeyChar())
System.out.println("This is the U key");
if(v == event.getKeyChar())
System.out.println("This is the V key");
if(w == event.getKeyChar())
System.out.println("This is the W key");
if(x == event.getKeyChar())
System.out.println("This is the X key");
if(y == event.getKeyChar())
System.out.println("This is the Y key");
if(z == event.getKeyChar())
System.out.println("This is the Z key");
}
public void keyPressed(KeyEvent event)
{
}
public void keyReleased(KeyEvent event)
{
}
}
}
And the two errors I get are...
F:\Documents\School\Period 3 - Java\Applets\Computer Club\ComputerClub.java:11: cannot find symbol
symbol : class KeyBoard
location: class ComputerClub
KeyBoard Handler = new KeyBoard();
F:\Documents\School\Period 3 - Java\Applets\Computer Club\ComputerClub.java:11: cannot find symbol
symbol : class KeyBoard
location: class ComputerClub
KeyBoard Handler = new KeyBoard();