• Post Reply Bookmark Topic Watch Topic
  • New Topic

MessageDialog without a button

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need a MessageDialog that has no buttons at all. This dialog should only show a message and should finally closed by my program.
Thanks a lot !!!
 
ernest fakudze
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kay,
Why would you want a message dialog that has no button on it? The main purpose of dialogs is that a certain action causes them to pop up and the user has to attennd them by pressing either an OK, CANCEL or SOME OTHER BUTTON. What you are attempting to do defeats the purpose of dialogs.
is this dialog going to be modal or non-modal?
Please note that i'm still new to GUIs myself but I think some other people can vouch for me on this.
That having been said, you can still subclass the JDialog class and put a JLabel there for it to display. When it appears it will have the [X] button on the top right so that you can press that to close it but it will not work unless you have some events associated with closing it. Also, the dialog should belogn to a frame for it to be displayed because a dialog needs to rely on a top level-window.
So please tell us why you need this kind of dialog. maybe it's just me being clueless but then again I'm new.
Regards,
Ernie
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,
i too am not clear with the idea of a Messageboc not having any Buttons on it.Any way,if its ur requirement,then u need to follow what Ernie had suggested.
Raj
 
Wahid Sadik
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parhaps he wants something like a splash screen.. it so, make it a Window... and have a thread close after a while
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is quit simple, I think. I have some threads running. Theses threads should running until their finnished, but if the user closes the application the threads will be killed too. I have to check the threads and when their are still alive I want to show a message dialog (monolog) that the user must wait. I thought I can do this with one line of code like : JOptionPane.showMessageDialog(..)
Thanks for your answers!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can't use JOptionPane, because it assumes you are going to be making normal dialog boxes with buttons. You'll have to use JDialog and make your own special dialog box to handle this. You may have thought of this already, but I would put a JProgressBar or something on the dialog to let the user know why you have blocked access to the app and about how long they are going to have to wait for the thread to stop.

-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!