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 anyt
To simply make them disappear, try the following:
setUndecorated(true);
This will help you:
frame.setDefaultCloseOperation(0);
For those coming to this later than 2008, there has been a change making it possible to do this. See this link
Second response from the bottom shows how to do it by name.
If I understand it correctly, this bug report indicates that this is currently not possible.
Please try this
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
e.getWindow().setVisible(false);
try {
wait();
} catch (InterruptedException ex) {
Logger.getLogger(WindowsActions.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
This is probably the best you are going to get:
setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.NONE);
This will remove the entire titlebar, java doesn't really specify a way to remove individual components of the titlebar
edit:
There may be a way, check out these threads: