import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class GeometryUnity {
    public static void main(String[] args){
        JFrame frame = new JFrame("Geometry Test");
        frame.getContentPane().setLayout(new BorderLayout());
        JPanel p = new JPanel();
        JButton btn = new JButton(new AbstractAction("click") {
                @Override
                public void actionPerformed(ActionEvent e) {
                    makeDlg();
                }
            });
        p.add(btn);
        frame.getContentPane().add(p, BorderLayout.CENTER);

        frame.setSize(400, 300);
        frame.setLocation(100,100);
        frame.show();
    }
    
    public static void makeDlg() {
        final JDialog dlg = new JDialog();
        dlg.setLayout(new BorderLayout());
        dlg.setSize(200, 200);
        dlg.setLocation(300,400);
        JButton btn2 = new JButton(new AbstractAction("click2") {
                @Override
                public void actionPerformed(ActionEvent e) {
                    System.out.println("dlg.getLocationOnScreen()="+dlg.getLocationOnScreen());
                }
            });
        dlg.add(btn2, BorderLayout.CENTER);
        dlg.setVisible(true);
        System.out.println("dlg.getLocationOnScreen()="+dlg.getLocationOnScreen());
    }
}
