• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionListener compatibility issue  RSS feed

Gary McGath
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet which I have written works with multiple browsers on Windows and Mac OS 9 and X; it's designed to be Java 1.1 compatible. However, when I tried it this past weekend with Mozilla on a Linux box, its buttons were non-functional. It's using the Blackdown JVM, Java 1.3.1. The buttons highlight appropriately when clicked, but the expected actions don't happen. (Actually, the actions did happen twice in a row after about forty tries, then wouldn't happen again.)
The applet class extends Applet and implements ActionListener.
editCmd is defined for the class as
static final String editCmd = "edit";

The applet's init() function calls
editButton = new Button("Edit");

The applet's destroy() function calls
removeActionListener isn't explicitly called anywhere else in the applet.
The actionPerformed function looks like this, with irrelevant code omitted:
public void actionPerformed(ActionEvent evt) {
String cmd = evt.getActionCommand();
try {
if (cmd.equals(editCmd))
/* do stuff */
/* Exception handling */
Does anyone have an idea why this fails just in some implementations?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!