Using frame.setUndecorated(true) while the frame has already been displayed results in an error, as this is not valid in the API . Instead, use frame.setUndecorated(true) before setting frame.setVisible(true) . This should solve your error:
IllegalComponentStateException - frame is displayed
If you are successful, the close button will be hidden.
Dhruv gairola
source share