Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

public boolean action

843807May 14 2007 — edited May 14 2007
Didn't know where to post this but I think it belongs here...

Well... I have got this ImageButton class wich makes buttons of images, but it seems to be a little out of date and it uses the public boolean action(Event e, Object arg) method for event handling... If I remember correctly it's also deprecated to do it this way and that you should register the component as ActionListener instead. But... I have no idea how to do it, the only thing I can say about the ImageButton class is that it is extending Canvas.

Here is the method handling button actions:
public boolean action(Event e, Object arg) {
	if (e.target instanceof ImageButton) {
		ImageButton button = (ImageButton)e.target;
		int i = findColor(button);
		if (i>=0) {
//				currentColor = i;
		} else {
			System.out.println("unknown image button pressed");
		}
	}
	return true;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2007
Added on May 14 2007
1 comment
396 views