Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检测用户何时点击我的 JFrame。我做了相当多的研究,但只能找到有关单击 Swing 元素的信息。我希望你们能帮助我。提前致谢。
由于我无法将其放入评论中,因此我将其放在这里:
frame.getContentPane().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("Click!"); } });