handleEvent not switching on type of event
Quote:
Originally Posted by
Mir
(...snip...)What happen when i click on About Dialog then exe close autometically.All other menu is working..
Norm, what is happening here is that window events and other events are processed in code by a mix of sub-typing ( class a instance of class b )? true/false and a java construct called a switch. A switch is an effective code construct for having the compiler create a jump table.
Poster has: Code:
public boolean handleEvent (Event event)
{
switch (event.id) {
case Event.WINDOW_DESTROY:
dispose();
return true;
default:
return super.handleEvent(event);
}
}
Okay, sounds good but due to using event id, we should look at the value of Event.WINDOW_DESTROY as it should not be but may be numeric equivalent of some other class that is shipping an event to the code here.
At least that is what it sounds like, based on poster's original description:
Quote:
when i click on About Dialog then exe close autometically.
Above that, code shows: Code:
if (evt.target instanceof Button)
Which also ( with logic that follows ) closes the window.
Code:
public void mouseClicked(MouseEvent e){
would process a mouse event to launch URL, but that is not shown in code.
This project needs additional work disentangling event processing logic.