Java – equivalent to JFrame What is the AWT of setdefaultcloseoperation?
•
Java
We use the setdefaultcloseoperation (JFrame. Exit_on_close) method of JFrame
I want to support the native look and feel, so I have to use AWT instead of swing So what is the AWT method equivalent to setdefaultcloseoperation?
Do I think we should use AWT instead of swing to support native appearance?
Solution
There is no equivalent in AWT, but you can build it yourself
myFrame.addWindowListener( new WindowAdapter(){ public void windowClosed(WindowEvent e) { System.exit(0); } } );
You can approach native fidelity without using AWT Instead, set the default look & feel to use uimanager
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeel());
You must do this before displaying any UI, or things will get a little fuzzy
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码