• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to disable JDialog close window button?  RSS feed

 
Murali Obla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
I have a JProgress Bar inside a Jdialog box, which has the close window button. I want to disable the close window button when the progress bar is progressing!.
ie I want to discolor it ideally(grey color).
How to do that?
Any suggestions,
NOTE:
DONOTHING_ON_CLOSE,HIDE_ON_CLOSE,EXIT_ON_CLOSE is not the required solution.
Pls Reply ASAP,
TAI,
Murali
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Murali,
This is just a suggestion. If you are using version 1.4 of java, have you investigated the setUndecorated() method in class java.awt.Dialog
http://java.sun.com/j2se/1.4.1/docs/api/java/awt/Dialog.html
Hope it helps.
Good Luck,
Avi.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setUndecorated() makes the entire titlebar and border disappear... I'd just use setDefaultCloseOperation( DO_NOTHING_ON_CLOSE ); You (unfortunately) can't grey out the close button because it is provided by the native OS resources. I've even seen regualar MS apps that do this (have a non-closable dialog but do not grey out the close button).
 
Keith Bennett
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand -- can't you called button.setEnabled(false) when you want to disable it and button.setEnabled(true) when you want to reenable it? (Or better yet, call setEnabled() on the javax.swing.Action.)
- Keith
 
Tim Schmelter
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Keith,
but what button do you want to disable ?
The close-button of JFrames, JDialogs etc.
are created from OS (heavyweight).
regards
Tim
 
Murali Obla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to All,
Thanks Avi, I'll try setUndecorated() method.
Keith,
I think you got confused with my question. I have meant the X(window close)button in the top right corner of the JDialog box. Any ways Thanks for your kind reply.
Nathan,
I have seen in some installation programs that the X button is disabled(meaning decoloured). How is that possible?. Is that the property of Install Shield program??. Why can't we do it in Java??.
Tim,
You are absolutely right, it is created by OS heavy weight!. Any possible ways Tim?.
TIA,
Murali
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!