Skip to main content

ActionListener for Keypad.java not working

2 replies [Last post]
jlnickymaster
Offline
Joined: 2007-05-02

I compile correctly but cannot understand why when I push the keys nothing is
happening on my program. I have an ActionListner and an event built into this Keypad.
But, it does not seem to be working. Can you take and look and point me in the right
direction?

[code]
// Java Document

/*Build and execute a program for a security keypad. The valid security codes are:

* 1645

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tarbo
Offline
Joined: 2006-12-18

[i]Captain's Log, Stardate 6051: had trouble sleeping last night... my hiatal hernia is acting up. The ship is drafty and damp; I complain, but... [b]nobody listens[/b].[/i]

You will have to register your action listener with the needed components. Don't worry, ace, happens to the best of us. ;)

jlnickymaster
Offline
Joined: 2007-05-02

OH! need more coffee!

I went ahead and put
keys[1].addActionListener( this );
keys[2].addActionListener( this );
keys[3].addActionListener(this);
keys[4].addActionListener(this);
etc.

into the appropriate area.

thanks