views:

3285

answers:

2

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

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

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

+2  A: 

If I understand it correctly, this bug report indicates that this is currently not possible.

bdumitriu
+3  A: 

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: http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2&t=015407 http://forums.sun.com/thread.jspa?messageID=10255068

Malfist