[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/70663] New: Component.dispatchEvent ignores ActionEvents
From: |
guillerodriguez.dev at gmail dot com |
Subject: |
[Bug classpath/70663] New: Component.dispatchEvent ignores ActionEvents |
Date: |
Thu, 14 Apr 2016 11:11:20 +0000 |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70663
Bug ID: 70663
Summary: Component.dispatchEvent ignores ActionEvents
Product: classpath
Version: 0.99
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
Assignee: unassigned at gcc dot gnu.org
Reporter: guillerodriguez.dev at gmail dot com
Target Milestone: ---
The API specification for java.awt.Component.dispatchEvent() says: "Dispatches
an event to this component or one of its sub components. Calls processEvent
before returning for 1.1-style events which have been enabled for the
Component."
According to this description, the attached sample code should output this:
Dispatching action event
processEvent called
This works as expected on OpenJDK. However in GNU Classpath thw result is:
Dispatching action event
i.e. the processEvent() method is never called.
This happens because the eventTypeEnabled() method in Classpath's
implementation of Component does not know about action events and will always
return false for them, even if they have been enabled.
This breaks lightweight components that generate action events by themselves.
Sample code follows.
===
import java.awt.*;
import java.awt.event.ActionEvent;
public class Sample extends Component
{
protected void processEvent(AWTEvent e)
{
System.out.println("processEvent called");
super.processEvent(e);
}
public void simulateActionEvent()
{
System.out.println("Dispatching action event");
enableEvents(AWTEvent.ACTION_EVENT_MASK);
ActionEvent ev = new ActionEvent(this,
ActionEvent.ACTION_PERFORMED, "test");
dispatchEvent(ev);
}
public static void main(String args[])
{
Sample sample = new Sample();
sample.simulateActionEvent();
}
}
===
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/70663] New: Component.dispatchEvent ignores ActionEvents,
guillerodriguez.dev at gmail dot com <=