All Things Techie With Huge, Unstructured, Intuitive Leaps

SWT Dialog To Front

I am working in org.eclipse.swt Java.  I create a dialog box.  The app was full screen and I didn't have any minimize corners on the screen.  I created a password dialog with code using the following:

PasswordDialog dialog = new PasswordDialog(new Shell());

When I ran the code, the main window was up front the the dialog was behind it. I knew this because the only way that I could see it, was with a task manager.

What to do?  I searched for a .toFront() method to no avail.  Finally I happened on the SWT.ON_TOP integer to use in the constructor, like this:

PasswordDialog dialog = new PasswordDialog(new Shell(SWT.ON_TOP));

Worked like a charm.  Hope this helps someone.

1 comment: