Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>setLocation moves to the x,y based on the parent, getLocationOnScreen will get location based on screen...</p> <p>There is no guarantee that getLocation and getLocationOnScreen would be the same.. getLocation is "relative" while getLocationOnScreen is absolute.</p> <p><a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#getLocationOnScreen()" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#getLocationOnScreen()</a> <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#getLocation()" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#getLocation()</a> <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#setLocation(int" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#setLocation(int</a>, int)</p> <p>This is my output for your code:</p> <pre><code>java.awt.Point[x=100,y=100] </code></pre> <p>Which java version are you using? Mine is 1.7.0_25, maybe there is a difference between default behaviors for JFrame since the top component "should" have as parent the screen.</p> <pre><code>Update from comments: java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode) Ubuntu 12.04 </code></pre> <p>Sometimes you get 100,100 and sometimes 101, 128</p> <p>Different behaviors for JFrame.setLocation JFrame.getLocationOnScreen In windows I always get 100, 100 for this particular case.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload