tags:

views:

1216

answers:

5

I have problem currently for my swing reminder application, which able to minimize to tray on close. My problem here is, I need JOptionPane dialog to pop up on time according to what I set, but problem here is, when I minimize it, the dialog will pop up, but not in the top of windows when other application like explorer, firefox is running, anyone know how to pop up the dialog box on top of windows no matter what application is running?

+1  A: 

Windows is blocking this operation since XP.

The scenario before was like: Your a tiping in some text in an editor and not recognize that another dialog is coming to front when you are tipping the text. The coming dialog gets the focus and you are tiping in the new dialog. Maybe you click enter after you are ready and do this in the wrong dialog, which is asking whether you realy want to delet your hard disk ;)

The come to front call in java is only working for java windows.

The possibibilty to notify the user of a new window is to implement a Frame, which will highlighted/flashing in the windows task bar.

Markus Lausberg
To expand in the comment, which is really good. Use something that extends JFrame instead of something that extends JDialog to get something flashing in the task bar when you invoke bring to front
Mario Ortegón
A: 

You might think about using a JFrame instead. It may give you a little more flexibility.

If you are using a JFrame and you want it to popup on top of the other windows use:

myFrame.setVisible(true);
myFrame.setState(NORMAL);

The setState will show the window to the user if it was in minimized state previously.

ShawnD
A: 

Are you using one of the canned JOptionPanes? (Like JOptionPane.showCOnfirmDialog(...))

You may want to look at extending JDialog and making your own dialog panel, and then calling myDialog.setAlwaysOnTop(true);

A: 

Hi guys, thanks for your answer, I have resolve my problem as below:

this.setVisible(true); // show main frame MyDialog dialog = New MyDialog(); // show my custom dialog dialog.setVisible(true); this.setVisible(false);

this works fine for me :)

Dickson
A: 

Correction the post above..

I have resolve my problem as below:

this.setVisible(true); // show main frame

MyDialog dialog = New MyDialog(this, true); // show my custom dialog

dialog.setVisible(true);

this.setVisible(false);

it works fine for me :)

Dickson