Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Close Button

 
Noman Iqbal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
bye
Noman Iqbal.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...



-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic