简体   繁体   中英

Java - is there a way to hide the close button in a swing application?

is there a way to hide the close button in a swing application?

I know I can set JFrame.DO_NOTHING_ON_CLOSE but is there a way to eliminate it completely?

if I write setUndecorated(true) I get
IllegalComponentStateException - the frame is displayable

Using frame.setUndecorated(true) while the frame has already been displayed leads to an error as this is not allowed in the API . Instead, use frame.setUndecorated(true) before you set frame.setVisible(true) . This should solve your error:

IllegalComponentStateException - the frame is displayable

If you are successful, the close button will be hidden.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM