Java: how to register a listener that listen to a JFrame movement

后端 未结 3 1996
死守一世寂寞
死守一世寂寞 2021-01-20 02:55

How can you track the movement of a JFrame itself? I\'d like to register a listener that would be called back every single time JFrame.getLocation() is going to

3条回答
  •  独厮守ぢ
    2021-01-20 03:21

    Using addComponentListener() with a ComponentAdapter:

    jf.addComponentListener(new ComponentAdapter() {
        public void componentMoved(ComponentEvent e) {
            updateText(jf, jl);
        }
    });
    

提交回复
热议问题