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.
我想为 JDialog 实现最小化功能,使用自定义最小化图形图标。我谷歌了它,但没有找到任何令人满意的解决方案。我在此页面上找到了一些非常接近的解决方案
但它用于实现 JFrame ,我想为 JDialog 实现。
您可能正在寻找WindowListener:
WindowListener
JDialog f = new JDialog(); f.setSize(100, 100); f.setVisible(true); f.addWindowListener(new WindowAdapter() { @Override public void windowIconified(WindowEvent e) { System.out.println("Hi!"); // Do here your custom action } });