-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
b28
-
sparc
-
solaris_2.6
Name: dsR10051 Date: 10/17/2000
The method
protected void java.awt.Component.processFocusEvent(FocusEvent e)
is not called by event dispatch thread even if a FocusListener
object is registered via addFocusListener
(See JavaDoc for Component.processFocusEvent).
Here is a minimized test:
import java.awt.*;
import java.awt.event.*;
public class ComponentTest4 {
public static void main (String[] args) {
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
ChildComponent chcomponent = new ChildComponent();
FocusEvent e = new FocusEvent(chcomponent, FocusEvent.FOCUS_LOST);
DummyFocusListener cl = new DummyFocusListener();
chcomponent.addFocusListener(cl);
eq.postEvent(e);
synchronized (chcomponent) {
while(!chcomponent.focusEventProcessed) {
try {
System.out.println("Waiting");
System.out.flush();
chcomponent.wait();
System.out.println("Done");
System.out.flush();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
System.exit(0);
}
}
class ChildComponent extends Component {
public ChildComponent() {
super();
}
boolean focusEventProcessed = false;
public synchronized void processFocusEvent(FocusEvent e) {
focusEventProcessed = true;
System.out.println("processFocusEvent called");
System.out.flush();
super.processFocusEvent(e);
System.out.println("processFocusEvent done");
System.out.flush();
notifyAll();
}
}
class DummyFocusListener extends FocusAdapter {
}
--- Output ---
%/net/sword/export3/JDK1.4.0beta-b36/solaris/bin/java -version
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b36)
Java HotSpot(TM) Client VM (build 1.4beta-B36, mixed mode)
%/net/sword/export3/JDK1.4.0beta-b36/solaris/bin/java ComponentTest4
Waiting
^C
%
======================================================================
The method
protected void java.awt.Component.processFocusEvent(FocusEvent e)
is not called by event dispatch thread even if a FocusListener
object is registered via addFocusListener
(See JavaDoc for Component.processFocusEvent).
Here is a minimized test:
import java.awt.*;
import java.awt.event.*;
public class ComponentTest4 {
public static void main (String[] args) {
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
ChildComponent chcomponent = new ChildComponent();
FocusEvent e = new FocusEvent(chcomponent, FocusEvent.FOCUS_LOST);
DummyFocusListener cl = new DummyFocusListener();
chcomponent.addFocusListener(cl);
eq.postEvent(e);
synchronized (chcomponent) {
while(!chcomponent.focusEventProcessed) {
try {
System.out.println("Waiting");
System.out.flush();
chcomponent.wait();
System.out.println("Done");
System.out.flush();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
System.exit(0);
}
}
class ChildComponent extends Component {
public ChildComponent() {
super();
}
boolean focusEventProcessed = false;
public synchronized void processFocusEvent(FocusEvent e) {
focusEventProcessed = true;
System.out.println("processFocusEvent called");
System.out.flush();
super.processFocusEvent(e);
System.out.println("processFocusEvent done");
System.out.flush();
notifyAll();
}
}
class DummyFocusListener extends FocusAdapter {
}
--- Output ---
%/net/sword/export3/JDK1.4.0beta-b36/solaris/bin/java -version
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b36)
Java HotSpot(TM) Client VM (build 1.4beta-B36, mixed mode)
%/net/sword/export3/JDK1.4.0beta-b36/solaris/bin/java ComponentTest4
Waiting
^C
%
======================================================================
- relates to
-
JDK-6244370 Spec for Component.processFocusEvent/processKeyEvent doesn't match the implementation
- Open
-
JDK-4379922 Component.processKeyEvent is not called by event dispatch thread
- Resolved