Java – How to disable (or hide) the close (x) button on a JFrame


I have a window (derived from JFrame) and I want to disable the close button during certain operations which are not interruptible. I know I can make the button not do anything (or call a handler in a WindowListener) by calling


but I would like to make it clear visually that it is pointless to click it.

Best Solution

This is probably the best you are going to get:


This will remove the entire titlebar, java doesn't really specify a way to remove individual components of the titlebar


There may be a way, check out these threads:

Related Question