-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
generic, sparc
-
generic, solaris_2.6
Name: aaR10142 Date: 06/28/2000
SwingUtilities.convertPointToScreen() and
SwingUtilities.convertPointFromScreen() methods throw unspecified
IllegalComponentStateException
The javadoc says nothing about it.
The javadoc says:"
public static void convertPointFromScreen(Point p,
Component c)
Convert a point from a screen coordinates to a
component's coordinate system
Parameters:
p - a Point object (converted to the new
coordinate system)
c - a Component object
"
All works correctly in jdk1.3
See example
------------------------- example ----------------
import javax.swing.*;
import java.awt.Point;
public class Test {
public static void main(String argv[]) {
JFrame c = new JFrame();
Point pt=new Point(0,0);
SwingUtilities.convertPointToScreen(pt, c);
System.out.println("result:"+ pt);
SwingUtilities.convertPointFromScreen(pt, c);
System.out.println("result:"+ pt);
}
}
------------------------- jdk1.4 output ----------------
Exception in thread "main" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1316)
at java.awt.Component.getLocationOnScreen(Component.java:1290)
at javax.swing.SwingUtilities.convertPointToScreen(SwingUtilities.java:255)
at Test.main(Test.java:10)
------------------------- jdk1.3 output ----------------
result:java.awt.Point[x=0,y=0]
result:java.awt.Point[x=0,y=0]
======================================================================
- duplicates
-
JDK-4351121 jck_regr: api/javax_swing/SwingUtilities/descriptions.html#coord
-
- Closed
-