public class TopMostOptionPane
extends java.lang.Object
Show the dialog on top most level, which means it will be shown before other windows. To achieve this goal, we tried to set the dialog's parent on the top most. If the provided parent is null, then we create a JFrame object as parent and bring it to top most before showing dialog; after dialog is closed, we dispose the JFrame. If the provided parent is not null, we will bring it to top most and set it to visible before showing dialog; after dialog is closed, we set back the parent's status.
Current, this class supports the following methods:Modifier and Type | Method and Description |
---|---|
void |
cleanup()
This should be called after the dialog is closed, For example after calling JOptionPane#showOptionDialog().
It will close the parent window if it is created automatically. It will set the parent's status to original if the parent is a Window object. It will do nothing if the parent object is not instance of Window. |
static void |
main(java.lang.String[] args) |
static int |
showConfirmDialog(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.String title,
int optionType) |
static int |
showConfirmDialog(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.String title,
int optionType,
int messageType) |
static int |
showConfirmDialog(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.String title,
int optionType,
int messageType,
javax.swing.Icon icon) |
static java.lang.Object |
showInputDialog(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.String title,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] selectionValues,
java.lang.Object initialSelectionValue)
Show the Input Dialog on top most.
|
static int |
showOptionDialog(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.String title,
int optionType,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] options,
java.lang.Object initialValue)
Show the Option Dialog on top most.
|
public void cleanup()
public static java.lang.Object showInputDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon, java.lang.Object[] selectionValues, java.lang.Object initialSelectionValue) throws java.awt.HeadlessException
java.awt.HeadlessException
JOptionPane.showInputDialog(Component, Object, String, int, Icon, Object[], Object)
public static int showOptionDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue) throws java.awt.HeadlessException
java.awt.HeadlessException
JOptionPane.showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)
public static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType) throws java.awt.HeadlessException
java.awt.HeadlessException
showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)
public static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType) throws java.awt.HeadlessException
java.awt.HeadlessException
showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)
public static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon) throws java.awt.HeadlessException
java.awt.HeadlessException
showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)
public static void main(java.lang.String[] args)
Copyright © SAS Institute. All Rights Reserved.