How to disable or remove Close Button on JFrames???
Sun Certified Java Programmer
VIJAY Yadlapati
Ranch Hand
Joined: Aug 04, 2003
Posts: 175
posted
0
You can't remove close Button from JFrames, but you can disable by calling setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) on that JFrame.
Bhagya Tangutur
Ranch Hand
Joined: Oct 21, 2002
Posts: 88
posted
0
Yes...I am already calling that function.My concern is It doen't look like it's disabled.so i wanna change it's icon or i totally wanna remove that close button.because it is just misleads to the user.
Ken Blair
Ranch Hand
Joined: Jul 15, 2003
Posts: 1078
posted
0
Actually you could try this but I really don't think it's what you want, it's going to remove all window decorations (there will be no title bar, etc.) and I'm not even sure if it's supported on all platforms. I don't think it works on pre 1.4 either.
Also look into JWindow which is similar, no titlebar with buttons and what not. [ August 10, 2003: Message edited by: Ken Blair ]
Bhagya Tangutur
Ranch Hand
Joined: Oct 21, 2002
Posts: 88
posted
0
Ken, your right ...it doesn't work prior to jdk1.4. besides,I want to keep all other buttons,Title(Frame/Window decorations).Thanks for u r sussestion,I came to know something new with your posting.
I know this is an old thread now, but i found it while searching for the answer to the problem myself. I post this here as I found this way the best for me, perhaps someone else searching for this finds it useful..
Welcome to JavaRanch, Sean. Thank you. Actually there are ways to remove the X button from a JFrame, somebody showed us how last year, but I can't remember when.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32651
4
posted
0
I ahve found the old thread with details of how to remove the close button: here.