permaculture playing cards
The moose likes Java in General and the fly likes Close Button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Close Button" Watch "Close Button" New topic

Close Button

Noman Iqbal
Ranch Hand

Joined: Jun 25, 2001
Posts: 100
Hi Dear friends,
Can any body tell me that in awt how to disable the minimize, maximize and close buttons of a Frame, remember I don't need to disappear these buttons but to disablethem, means that they will be visible but will not be able to press. Waiting for your reply.
Noman Iqbal.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

I don't think you can really disable them ( other than maximize... ) without JNI... but here's some code that shows the closest I can get to it...

Basically, it just eats WindowIconified and WindowClosing events... unfortunatly, the events are sent in response to the actual event occuring... so you don't get a WindowIconified event until after the window is already iconified... Unfortunately, disableEvents() doesn't mean what you think it does at first glance... Also, the buttons are not displayed as disabled, but I think this is because they aren't Java buttons... they are actually Windows buttons...

What about using a Window instead of a Frame? That leaves those pesky buttons off entirely...


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Close Button
It's not a secret anymore!