Comments (2)
Comment author: @guillerodriguez
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();
}
}
from classpath.
Comment author: @guillerodriguez
Created attachment 38268
Proposed fix
The attached patch fixes this behaviour.
Attached file: Component_dispatch_action_events.patch (text/plain, 303 bytes)
Description: Proposed fix
from classpath.
Related Issues (20)
- use freedesktop mime type library HOT 4
- [meta-bug] Java security model tracking PR HOT 3
- [meta-bug] Java security model tracking PR HOT 3
- [meta-bug] TimeZone Issues in libgcj/classpath HOT 5
- Negative suffix not properly handled in DecimalFormat (Bugzilla issue 70658) HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Negative suffix not properly handled in DecimalFormat HOT 2
- Incorrect implementation of Selector.wakeup() HOT 5
- BigDecimal.stripTrailingZero throws exception if value is zero HOT 2
- VMProcess.destroy() throws InternalError for non existing processes HOT 5
- VMProcess.<init>()/destroy() affect thread interrupt flag HOT 3
- Negative suffix not properly handled in DecimalFormat (Bugzilla Bug 70658)
- Negative suffix not properly handled in DecimalFormat (Bugzilla #70658)
- test
- Teswt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classpath.