• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to remove the window close icon.

 
Sachindra Pratap
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
In my swing application ,i want to remove the close icon which comes at upper right cornor of the window.
I want to logout my application, by making use of logout button which i have put.

please convey the solution!.

regards
Sachindra
 
Maneesh Godbole
Saloon Keeper
Posts: 11167
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sachindra Pratap:
hi,
In my swing application ,i want to remove the close icon which comes at upper right cornor of the window.
I want to logout my application, by making use of logout button which i have put.

please convey the solution!.

regards
Sachindra


I dont think it is possible to do this without messing around with the ComponentUI.

However, if you set the which is the default behavior and add your own window listener, you can get notified when the user attempts to close the application window and process the event the way you want to.
[ September 18, 2008: Message edited by: Maneesh Godbole ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use JWindow or JFrame.setUndecorated(true) - however, both of these options remove all frame decorations - titlebar, icon, minimize button, maximize button, and close button.
 
Ted Smyth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm too lazy to search for the thread(s) about this topic (but you certainly are welcome to, I think there's at least two with relevant code/discussion), but here's a bit of code I found that seems to work in L&Fs excluding the Windows L&F on XP; it removes all buttons on the title bar:



Call it with the frame you want to remove buttons on.

I would have to recommend Mr. Godbole's suggestion if you are planning to deploy an app on XP.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50175
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do a search through this forum; a similar subject came up about a year ago, with lots of code to show how it can be done.
 
Maneesh Godbole
Saloon Keeper
Posts: 11167
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Campbell Ritchie
Sheriff
Pie
Posts: 50175
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Maneesh, that is the thread I was thinking of. Well done finding it
 
Sachindra Pratap
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou all of you!

regards
Sachindra
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic