• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable or remove Close Button on JFrame

 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to disable or remove Close Button on JFrames???
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Use JWindow instead of JFrame, the 3 buttons won't appear on JWindow.

Benson
 
sean van buggenum
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

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..

I posted my solution here:

http://forum.java.sun.com/thread.jspa?messageID=10255068

16th of May 2008
3:35 PM
 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ahve found the old thread with details of how to remove the close button: here.
 
Pairach Gestongma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i try

her her
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and what are you trying to do?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic