-
Bug
-
Resolution: Fixed
-
P4
-
1.1.7, 1.2.0
-
1.2.2
-
sparc
-
solaris_2.6
When calling getWhen() method it returns the wrong time. Look at times below.
Current Time = Fri Sep 25 16:06:16 EDT 1998
GetWhen Time = Tue Jan 06 18:17:56 EST 1970
Test Case:
***** Main.java *****
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Main extends Frame {
public Main() {
setTitle("getWhen Example");
setSize(500,100);
this.enableEvents(AWTEvent.MOUSE_EVENT_MASK);
setVisible(true);
}
protected void processEvent(AWTEvent evt) {
if (evt instanceof InputEvent) {
long currentTime = (new Date()).getTime();
long eventTime = ((InputEvent)evt).getWhen();
System.out.println("Current Time = " + new Date(currentTime));
System.out.println("GetWhen Time = " + new Date(eventTime));
}
}
public static void main (String args[]) {
new Main();
}
}
Current Time = Fri Sep 25 16:06:16 EDT 1998
GetWhen Time = Tue Jan 06 18:17:56 EST 1970
Test Case:
***** Main.java *****
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Main extends Frame {
public Main() {
setTitle("getWhen Example");
setSize(500,100);
this.enableEvents(AWTEvent.MOUSE_EVENT_MASK);
setVisible(true);
}
protected void processEvent(AWTEvent evt) {
if (evt instanceof InputEvent) {
long currentTime = (new Date()).getTime();
long eventTime = ((InputEvent)evt).getWhen();
System.out.println("Current Time = " + new Date(currentTime));
System.out.println("GetWhen Time = " + new Date(eventTime));
}
}
public static void main (String args[]) {
new Main();
}
}