[Top][All Lists]

[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


            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

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");

    public void simulateActionEvent()
        System.out.println("Dispatching action event");
        ActionEvent ev = new ActionEvent(this,
ActionEvent.ACTION_PERFORMED, "test");

    public static void main(String args[])
        Sample sample = new Sample();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]