mattjulius
asked on
Removing JFrame Close Button
I have an application which I have to remove the close button of the title bar of JFrame...can anybody help me.....
or use Jwindow instead of JFrame
You can use JFrame.setUndecorated(true ) and JFrame.getRootPane().setWi ndowDecora tionStyle( some_style _without_c lose_butto n), but this will only work if the current windowing system supports disabling native decorations (MS Windows does), and if the current look-and-feel supports window decorations. A quick test (in J2SE 1.4.2) shows that:
Metal LAF -- supports
Motif LAF -- does not support
Windows LAF -- does not support
i got this info from web, please check it once.
Metal LAF -- supports
Motif LAF -- does not support
Windows LAF -- does not support
i got this info from web, please check it once.
try this, this will disable the close button.
JFrame.this.setDefaultClos eOperation (WindowCon stants.DO_ NOTHING_ON _CLOSE);
JFrame.this.setDefaultClos
ASKER
What I wanna do is to remove the close button totally..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the issue with undecorated? You want the other buttons like minimize to be present?
ASKER
The issue w/ undecotated is it will also remove the titlebar wherein i just want to remove the close button.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
setUndecorated(true);
getRootPane().setWindowDec