File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
sources/net.sf.j2s.java.core/src/java/awt Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3081,14 +3081,16 @@ public void setLocationRelativeTo(Component c) {
30813081 }
30823082 }
30833083
3084- if ((c != null && !c .isShowing ()) || root == null || !root .isShowing ()) {
3084+ Point invokerScreenLocation ;
3085+ if (c != null && !c .isShowing ()
3086+ || root == null
3087+ || !root .isShowing ()
3088+ || (invokerScreenLocation = c .getLocationOnScreen ()) == null ) {
30853089 Dimension paneSize = getSize ();
30863090 Point centerPoint = GraphicsEnvironment .getLocalGraphicsEnvironment ().getCenterPoint ();
30873091 setLocation (centerPoint .x - paneSize .width / 2 , centerPoint .y - paneSize .height / 2 );
30883092 } else {
30893093 Dimension invokerSize = c .getSize ();
3090- Point invokerScreenLocation = c .getLocationOnScreen ();
3091-
30923094 Rectangle windowBounds = getBounds ();
30933095 int dx = invokerScreenLocation .x + ((invokerSize .width - windowBounds .width ) >> 1 );
30943096 int dy = invokerScreenLocation .y + ((invokerSize .height - windowBounds .height ) >> 1 );
You can’t perform that action at this time.
0 commit comments