Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

how to remove the window close icon.

 
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
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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 ]
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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.
 
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.
 
Marshal
Posts: 70696
288
  • 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.
 
Campbell Ritchie
Marshal
Posts: 70696
288
  • 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
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic