• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to disable or remove Close Button on JFrame

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to disable or remove Close Button on JFrames???
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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

Benson
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ahve found the old thread with details of how to remove the close button: here.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i try

her her
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and what are you trying to do?
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic