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 getIllegalComponentStateException - 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With