• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hiding X (exit button) button

 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, my name is Jeffry. I'm currently developing a GUI based application.

I want to hide X button in top right corner of my application window. How can I do that? Since I want the user exits my application from my button, I don't want the user exits from X button. Please help me with this problem. Thanks before.


Thanks


Jeffry Kristianto Yanuar.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frankly, it would be better if you wrote your application so that clicking on the "Close" button closed the application, like almost every other application ever written. Since it is possible to do that, I think you should. No point in doing things the hard way just because you don't know what the easy way is.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you say so, I think I should put some logic in X button that prevents quiting when there is unfinished process in different thread. It would be worse to just simply disable the X button and provide my own exit button.

How can I put some logic in X button? can you give the code snippet to do that?

Thanks before

Jeffry Kristianto Yanuar.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeffry Kristianto Yanuar:
Since I want the user exits my application from my button, I don't want the user exits from X button.


When you say UI Frame I am presuming JFrame.
You can add a window listener to the frame. One of the methods of window listener is windowClosing(WindowEvent we). You can implement this method to do whatever stuff you want to do before the application exits.

As a rule of the thumb, as far as possible, do not try to confuse the user with a different look and feel or functionality than he is used to. In this case, the user is used to clicking the X button to exit. So leave it like that.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'll try.


Thanks

Jeffry Kristianto Yanuar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!