public class DetermineWhenAJFrameIsMoved extends JFrame{//Create ComponentListener that will listen when JFrame is movingComponentListener cl=new ComponentAdapter(){ public void componentMoved(ComponentEvent event) { //Location that will show is base on top left corner of JFrame JOptionPane.showMessageDialog(null,"New location with :\n"+"X-coordinate : "+getLocation().getX()+"\n"+"Y-coordinate : "+getLocation().getY()); }};