Module tvbrowser
Package util.ui

Class UiUtilities


  • public class UiUtilities
    extends java.lang.Object
    Provides utilities for UI stuff.
    Author:
    Til Schneider, www.murfman.de
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static javax.swing.border.Border DIALOG_BORDER
      The border to use for dialogs.
      static java.awt.Insets ZERO_INSETS  
    • Constructor Summary

      Constructors 
      Constructor Description
      UiUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addKeyRotation​(javax.swing.JList<?> list)
      Adds support for rotating through list with up and down keys.
      static void addKeyRotation​(javax.swing.JTable table)
      Adds support for rotating through table with up and down keys.
      static void addKeyRotation​(javax.swing.JTable table, ProgramGetter programGetter)
      Adds support for rotating through table with up and down keys.
      static void addSeparatorsAfterIndexes​(javax.swing.JComboBox<java.lang.Object> combo, int[] indexes)  
      static void addSeparatorsAfterIndexes​(javax.swing.JComboBox<java.lang.Object> combo, java.lang.Integer[] indexes)  
      static void centerAndShow​(java.awt.Window win)
      Centers a window to its parent frame and shows it.
      static void centerAndShow​(java.awt.Window win, boolean show)
      Centers a window to its parent frame and shows it.
      static boolean colorsInEqualRange​(java.awt.Color c1, java.awt.Color c2, int maxDiff)
      Tests if the given colors are equal in the given maximum difference.
      static boolean containsModalDialogChild​(java.awt.Window parent)
      Gets if a dialog child of the given window is modal.
      static javax.swing.ImageIcon createChannelIcon​(javax.swing.Icon ic)
      Creates a scaled Version of the Icon.
      static javax.swing.JDialog createDialog​(java.awt.Component parent, boolean modal)  
      static javax.swing.JTextArea createHelpTextArea​(java.lang.String msg)
      Creates a text area that holds a help text.
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html)
      Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html, java.awt.Color background)
      Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html, java.awt.Color foreground, java.awt.Color background)
      Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html, javax.swing.event.HyperlinkListener listener)
      Creates a Html EditorPane that holds a HTML-Help Text.
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html, javax.swing.event.HyperlinkListener listener, java.awt.Color background)
      Creates a Html EditorPane that holds a HTML-Help Text.
      static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html, javax.swing.event.HyperlinkListener listener, java.awt.Color foreground, java.awt.Color background)
      Creates a Html EditorPane that holds a HTML-Help Text.
      static javax.swing.JFileChooser createNewFileChooser​(javax.swing.filechooser.FileFilter fileFilter)
      creates a new file chooser.
      static javax.swing.JPanel createPersonaBackgroundPanel()
      Creates a panel that has a semi-transparent background created of Persona colors.
      static javax.swing.JButton createToolBarButton​(java.lang.String text, javax.swing.Icon icon)
      Gibt einen Button mit Icon und Schrift zur�ck, der so initialisiert ist, da� man ihn gut f�r Symbolleisten nutzen kann (Rahmen nur bei Rollover sichtbar usw.).
      static java.awt.Window getBestDialogParent​(java.awt.Component parent)
      Gets the best dialog parent for a new JDialog.
      static int getChannelIconHeight()  
      static int getChannelIconWidth()  
      static int getCharsWidth​(java.awt.Font font, char[] chars, int offset, int length)
      Gets the width of the specified char array.
      static java.lang.String getDefaultLookAndFeelClassName​(boolean excludeGTK)  
      static java.lang.String getHTMLColorCode​(java.awt.Color color)
      returns a color code as used in HTML, e.g.
      static java.awt.Window getLastModalChildOf​(java.awt.Window parent)
      Gets the last visible modal child dialog of the specified window.
      static java.awt.Frame getParentFrameOnMouseScreen()  
      static int getStringWidth​(java.awt.Font font, java.lang.String str)
      Gets the width of the specified String.
      static boolean isGTKLookAndFeel()  
      static boolean isNimbusLookAndFeel()  
      static void moveSelectedItems​(javax.swing.JList list, int nrRows)
      Move selected Items in the JList
      static void moveSelectedItems​(javax.swing.JList list, int row, boolean sort)
      Move selected Items in the JList
      static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList, javax.swing.JList toList)
      Moves Selected Items from one List to another
      static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList, javax.swing.JList toList, int row)
      Moves Selected Items from one List to another
      static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList, javax.swing.JList toList, java.lang.Class... typeRemoveOnly)
      Moves Selected Items from one List to another
      static void registerForClosing​(javax.swing.JPopupMenu popupMenu)
      Registers the escape key, the R key and the context menu key as close key for a JPopupMenu.
      static void registerForClosing​(WindowClosingIf component)
      Registers the escape key as close key for a component.
      static javax.swing.Icon scaleIcon​(int newHeight, javax.swing.Icon icon)
      Scale Icons to a specific width.
      static javax.swing.Icon scaleIcon​(javax.swing.Icon icon, int newWidth)
      Scale Icons to a specific width.
      static javax.swing.Icon scaleIcon​(javax.swing.Icon icon, int width, int height)
      Scales Icons to a specific size
      static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img, int width, int height)
      Scales an image to a specific size and returns an BufferedImage
      static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img, int width, int height, int type)
      Scales an image to a specific size and returns an BufferedImage
      static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img, int targetWidth, int targetHeight, int type, java.awt.Color backgroundColor)
      Scales an image to a specific size and returns an BufferedImage
      static void setSize​(javax.swing.JDialog dialog, int width, int height)
      set the size of a dialog, but never sizes it smaller than the preferred size
      static int showConfirmDialogOnMouseScreen​(java.lang.Object message, java.lang.String title, int optionType, int messageType)
      Shows an JOptionPane confirm dialog on the screen the mouse pointer is currently visible.
      static java.lang.String showInputDialog​(java.awt.Component parentComponent, java.lang.Object message, java.lang.Object initialSelectionValue)
      Creates an JOptionPane that shows an input dialog with a document modality for the given parentComponent.
      static void showMessageDialogOnMouseScreen​(java.lang.Object message, java.lang.String title, int messageType)
      Shows an JOptionPane message dialog on the screen the mouse pointer is currently visible.
      static int showOptionDialogOnBestScreen​(java.awt.Component parent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue)
      Shows an JOptionPane option dialog on the screen the parent component is residing or if parent is null on the screen the mouse pointer is currently visible on.
      static int showOptionDialogOnMouseScreen​(java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue)
      Shows an JOptionPane option dialog on the screen the mouse pointer is currently visible.
      static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea, java.lang.String description)  
      static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea, java.lang.String html, java.awt.Color background)  
      static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea, java.lang.String html, java.awt.Color foreground, java.awt.Color background)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DIALOG_BORDER

        public static final javax.swing.border.Border DIALOG_BORDER
        The border to use for dialogs.
      • ZERO_INSETS

        public static final java.awt.Insets ZERO_INSETS
    • Constructor Detail

      • UiUtilities

        public UiUtilities()
    • Method Detail

      • centerAndShow

        public static void centerAndShow​(java.awt.Window win)
        Centers a window to its parent frame and shows it.

        If the window has no parent frame it will be centered to the screen.

        Parameters:
        win - The window to center and show.
      • centerAndShow

        public static void centerAndShow​(java.awt.Window win,
                                         boolean show)
        Centers a window to its parent frame and shows it.

        If the window has no parent frame it will be centered to the screen.

        Parameters:
        win - The window to center and show.
        Since:
        4.1
      • createDialog

        public static javax.swing.JDialog createDialog​(java.awt.Component parent,
                                                       boolean modal)
        Parameters:
        parent - A component in the component tree where the dialog should be created for.
        modal - Should the new dialog be modal?
        Returns:
        A new JDialog.
      • getBestDialogParent

        public static java.awt.Window getBestDialogParent​(java.awt.Component parent)
        Gets the best dialog parent for a new JDialog. The best parent is the last visible modal dialog in the component tree.

        If there is no visible modal dialog the root frame will be returned.

        Parameters:
        parent - One component of the component tree.
        Returns:
        the best dialog parent for a new JDialog.
      • getLastModalChildOf

        public static java.awt.Window getLastModalChildOf​(java.awt.Window parent)
        Gets the last visible modal child dialog of the specified window.

        If there is no visible modal child the window itself will be returned.

        Parameters:
        parent - The window to get the child from.
        Returns:
        the last visible modal child dialog of the specified window.
      • containsModalDialogChild

        public static boolean containsModalDialogChild​(java.awt.Window parent)
        Gets if a dialog child of the given window is modal.
        Parameters:
        parent - The window to check the children of.
        Returns:
        True if a child is modal, false otherwise.
        Since:
        2.7
      • createToolBarButton

        public static javax.swing.JButton createToolBarButton​(java.lang.String text,
                                                              javax.swing.Icon icon)
        Gibt einen Button mit Icon und Schrift zur�ck, der so initialisiert ist, da� man ihn gut f�r Symbolleisten nutzen kann (Rahmen nur bei Rollover sichtbar usw.).

        Wenn text und iconDateiname angegeben sind, dann wird text als TooltipText gesetzt.

        Parameters:
        text - Der Text des Buttons (Kann null sein, wenn der Button keinen Text enthalten soll)
        icon - Das Icon des Buttons (Kann ebenfalls null sein, wenn der Button kein Icon enthalten soll).
        Returns:
        button
      • getStringWidth

        public static int getStringWidth​(java.awt.Font font,
                                         java.lang.String str)
        Gets the width of the specified String.
        Parameters:
        str - The String to get the width for.
        font - The font being the base of the measure.
        Returns:
        the width of the specified String.
      • getCharsWidth

        public static int getCharsWidth​(java.awt.Font font,
                                        char[] chars,
                                        int offset,
                                        int length)
        Gets the width of the specified char array.
        Parameters:
        chars - The char array to get the width for.
        offset - The offset where to start.
        length - The length of the measure.
        font - The font being the base of the measure.
        Returns:
        the width of the specified char array.
      • createHelpTextArea

        public static javax.swing.JTextArea createHelpTextArea​(java.lang.String msg)
        Creates a text area that holds a help text.
        Parameters:
        msg - The help text.
        Returns:
        A text area containing the help text.
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html)
        Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
        Parameters:
        html - HTML-Text to display
        Returns:
        EditorPane that holds a Help Text
        Since:
        2.2
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html,
                                                                     java.awt.Color background)
        Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
        Parameters:
        html - HTML-Text to display
        background - The color for the background.
        Returns:
        EditorPane that holds a Help Text
        Since:
        2.7.2
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html,
                                                                     java.awt.Color foreground,
                                                                     java.awt.Color background)
        Creates a Html EditorPane that holds a HTML-Help Text Links will be displayed and are clickable
        Parameters:
        html - HTML-Text to display
        foreground - The color of the text.
        background - The color for the background.
        Returns:
        EditorPane that holds a Help Text
        Since:
        3.3.4
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html,
                                                                     javax.swing.event.HyperlinkListener listener)
        Creates a Html EditorPane that holds a HTML-Help Text. Add a Listener if you want to have clickable Links
        Parameters:
        html - HTML-Text to display
        listener - Link-Listener for this HelpText
        Returns:
        EditorPane that holds a Help Text
        Since:
        2.2
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html,
                                                                     javax.swing.event.HyperlinkListener listener,
                                                                     java.awt.Color background)
        Creates a Html EditorPane that holds a HTML-Help Text. Add a Listener if you want to have clickable Links
        Parameters:
        html - HTML-Text to display
        listener - Link-Listener for this HelpText
        background - The color for the background.
        Returns:
        EditorPane that holds a Help Text
        Since:
        2.7.2
      • createHtmlHelpTextArea

        public static javax.swing.JEditorPane createHtmlHelpTextArea​(java.lang.String html,
                                                                     javax.swing.event.HyperlinkListener listener,
                                                                     java.awt.Color foreground,
                                                                     java.awt.Color background)
        Creates a Html EditorPane that holds a HTML-Help Text. Add a Listener if you want to have clickable Links
        Parameters:
        html - HTML-Text to display
        listener - Link-Listener for this HelpText
        foreground - The color of the text.
        background - The color for the background.
        Returns:
        EditorPane that holds a Help Text
        Since:
        3.3.4
      • updateHtmlHelpTextArea

        public static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea,
                                                  java.lang.String html,
                                                  java.awt.Color foreground,
                                                  java.awt.Color background)
        Parameters:
        helpTextArea - The editor pane to update.
        html - The text for the editor pane.
        foreground - The foreground color.
        background - The background color.
        Since:
        3.3.4
      • updateHtmlHelpTextArea

        public static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea,
                                                  java.lang.String html,
                                                  java.awt.Color background)
        Parameters:
        helpTextArea - The help text area.
        html - The html string.
        background - The background color.
        Since:
        3.0.2
      • updateHtmlHelpTextArea

        public static void updateHtmlHelpTextArea​(javax.swing.JEditorPane helpTextArea,
                                                  java.lang.String description)
      • getHTMLColorCode

        public static java.lang.String getHTMLColorCode​(java.awt.Color color)
        returns a color code as used in HTML, e.g. #FF0000 for pure red
        Parameters:
        color - The color to get HTML color code for.
        Returns:
        HTML color code
      • moveSelectedItems

        public static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList,
                                                           javax.swing.JList toList)
        Moves Selected Items from one List to another
        Parameters:
        fromList - Move from this List
        toList - Move into this List
        Returns:
        Moved Elements
      • moveSelectedItems

        public static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList,
                                                           javax.swing.JList toList,
                                                           java.lang.Class... typeRemoveOnly)
        Moves Selected Items from one List to another
        Parameters:
        fromList - Move from this List
        toList - Move into this List
        typeRemoveOnly - Classes of types that should only be removed.
        Returns:
        Moved Elements
      • moveSelectedItems

        public static java.lang.Object[] moveSelectedItems​(javax.swing.JList fromList,
                                                           javax.swing.JList toList,
                                                           int row)
        Moves Selected Items from one List to another
        Parameters:
        fromList - Move from this List
        toList - Move into this List
        row - The target row where to insert
        Returns:
        Moved Elements
      • moveSelectedItems

        public static void moveSelectedItems​(javax.swing.JList list,
                                             int row,
                                             boolean sort)
        Move selected Items in the JList
        Parameters:
        list - Move Items in this List
        row - The target row where to insert
        sort - Dummy parameter, does nothing
      • moveSelectedItems

        public static void moveSelectedItems​(javax.swing.JList list,
                                             int nrRows)
        Move selected Items in the JList
        Parameters:
        list - Move Items in this List
        nrRows - Move Items nrRows up/down
      • scaleIcon

        public static javax.swing.Icon scaleIcon​(javax.swing.Icon icon,
                                                 int newWidth)
        Scale Icons to a specific width. The aspect ratio is kept.
        Parameters:
        icon - The icon to scale.
        newWidth - The new width of the icon.
        Returns:
        The scaled Icon.
      • scaleIcon

        public static javax.swing.Icon scaleIcon​(int newHeight,
                                                 javax.swing.Icon icon)
        Scale Icons to a specific width. The aspect ratio is kept.
        Parameters:
        icon - The icon to scale.
        newHeight - The new height of the icon.
        Returns:
        The scaled Icon.
      • scaleIcon

        public static javax.swing.Icon scaleIcon​(javax.swing.Icon icon,
                                                 int width,
                                                 int height)
        Scales Icons to a specific size
        Parameters:
        icon - Icon that should be scaled
        width - scaled width
        height - scaled height
        Returns:
        Scaled Icon
      • scaleIconToBufferedImage

        public static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img,
                                                                            int width,
                                                                            int height)
        Scales an image to a specific size and returns an BufferedImage
        Parameters:
        img - Scale this IMage
        width - new width
        height - new height
        Returns:
        Scaled BufferedImage
        Since:
        2.5
      • scaleIconToBufferedImage

        public static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img,
                                                                            int width,
                                                                            int height,
                                                                            int type)
        Scales an image to a specific size and returns an BufferedImage
        Parameters:
        img - Scale this image
        width - new width
        height - new height
        type - The type of the image.
        Returns:
        Scaled BufferedImage
        Since:
        2.7
      • scaleIconToBufferedImage

        public static java.awt.image.BufferedImage scaleIconToBufferedImage​(java.awt.image.BufferedImage img,
                                                                            int targetWidth,
                                                                            int targetHeight,
                                                                            int type,
                                                                            java.awt.Color backgroundColor)
        Scales an image to a specific size and returns an BufferedImage
        Parameters:
        img - Scale this image
        targetWidth - new width
        targetHeight - new height
        type - The type of the image.
        backgroundColor - The background color.
        Returns:
        Scaled BufferedImage
        Since:
        3.0
      • createChannelIcon

        public static javax.swing.ImageIcon createChannelIcon​(javax.swing.Icon ic)
        Creates a scaled Version of the Icon. The scaled Version will have a Background and a Border.
        Parameters:
        ic - The icon
        Returns:
        ImageIcon
        Since:
        2.1
      • getChannelIconHeight

        public static int getChannelIconHeight()
      • getChannelIconWidth

        public static int getChannelIconWidth()
      • registerForClosing

        public static void registerForClosing​(WindowClosingIf component)
        Registers the escape key as close key for a component.
        Parameters:
        component - The component to close on pressing escape key.
      • setSize

        public static void setSize​(javax.swing.JDialog dialog,
                                   int width,
                                   int height)
        set the size of a dialog, but never sizes it smaller than the preferred size
        Parameters:
        dialog - dialog to be sized
        width - wanted width
        height - wanted height
      • addSeparatorsAfterIndexes

        public static void addSeparatorsAfterIndexes​(javax.swing.JComboBox<java.lang.Object> combo,
                                                     int[] indexes)
      • addSeparatorsAfterIndexes

        public static void addSeparatorsAfterIndexes​(javax.swing.JComboBox<java.lang.Object> combo,
                                                     java.lang.Integer[] indexes)
      • createNewFileChooser

        public static javax.swing.JFileChooser createNewFileChooser​(javax.swing.filechooser.FileFilter fileFilter)
        creates a new file chooser. It is guaranteed that this happens in the UI thread.
        Parameters:
        fileFilter - file filter or null
        Returns:
        file chooser
      • colorsInEqualRange

        public static boolean colorsInEqualRange​(java.awt.Color c1,
                                                 java.awt.Color c2,
                                                 int maxDiff)
        Tests if the given colors are equal in the given maximum difference.

        Parameters:
        c1 - The first color.
        c2 - The second color.
        maxDiff - The maximum difference that counts as equal range.
        Returns:
        true if both colors are in the equal range.
      • createPersonaBackgroundPanel

        public static javax.swing.JPanel createPersonaBackgroundPanel()
        Creates a panel that has a semi-transparent background created of Persona colors.

        Returns:
        The created JPanel.
        Since:
        3.2
      • isNimbusLookAndFeel

        public static boolean isNimbusLookAndFeel()
        Returns:
        If the current LookAndFeel is Nimbus.
        Since:
        3.2
      • isGTKLookAndFeel

        public static boolean isGTKLookAndFeel()
        Returns:
        If the current LookAndFeel is GTK+.
        Since:
        3.2
      • getDefaultLookAndFeelClassName

        public static java.lang.String getDefaultLookAndFeelClassName​(boolean excludeGTK)
        Parameters:
        excludeGTK - true if the GTK+ look and feel should not be considered to be the default look and feel.
        Returns:
        The default LookAndFeel class name
        Since:
        3.4.2
      • showInputDialog

        public static final java.lang.String showInputDialog​(java.awt.Component parentComponent,
                                                             java.lang.Object message,
                                                             java.lang.Object initialSelectionValue)
        Creates an JOptionPane that shows an input dialog with a document modality for the given parentComponent.
        Parameters:
        parentComponent - The parent of the dialog
        message - The message to show
        initialSelectionValue - The initial input value.
        Returns:
        The user input or null
        Since:
        3.4.5
      • addKeyRotation

        public static void addKeyRotation​(javax.swing.JList<?> list)
        Adds support for rotating through list with up and down keys.

        Parameters:
        list - The list to add the rotation to
        Since:
        3.4.5
      • addKeyRotation

        public static void addKeyRotation​(javax.swing.JTable table)
        Adds support for rotating through table with up and down keys.

        Parameters:
        table - The table to add the rotation to
        Since:
        3.4.5
      • addKeyRotation

        public static void addKeyRotation​(javax.swing.JTable table,
                                          ProgramGetter programGetter)
        Adds support for rotating through table with up and down keys.

        Parameters:
        table - The table to add the rotation to
        programGetter - If date separators should not be selected the programs in the table have to be checked for the example program.
        Since:
        3.4.5
      • registerForClosing

        public static void registerForClosing​(javax.swing.JPopupMenu popupMenu)
        Registers the escape key, the R key and the context menu key as close key for a JPopupMenu.
        Parameters:
        popupMenu - The popup menu to add the closing keys.
        Since:
        3.4.5
      • getParentFrameOnMouseScreen

        public static java.awt.Frame getParentFrameOnMouseScreen()
        Returns:
        The frame with a graphics configuration of the screen the mouse is currently visible
        Since:
        4.2.2
      • showMessageDialogOnMouseScreen

        public static void showMessageDialogOnMouseScreen​(java.lang.Object message,
                                                          java.lang.String title,
                                                          int messageType)
        Shows an JOptionPane message dialog on the screen the mouse pointer is currently visible.
        Parameters:
        message - The message to show.
        title - The title of the dialog.
        messageType - The JOptionPane messageType.
      • showConfirmDialogOnMouseScreen

        public static int showConfirmDialogOnMouseScreen​(java.lang.Object message,
                                                         java.lang.String title,
                                                         int optionType,
                                                         int messageType)
        Shows an JOptionPane confirm dialog on the screen the mouse pointer is currently visible.
        Parameters:
        message - The message to show.
        title - The title of the dialog.
        optionType - The JOptionPane optionType.
        messageType - The JOptionPane messageType.
        Returns:
        The return value of the option dialog
        Since:
        4.2.2
      • showOptionDialogOnBestScreen

        public static int showOptionDialogOnBestScreen​(java.awt.Component parent,
                                                       java.lang.Object message,
                                                       java.lang.String title,
                                                       int optionType,
                                                       int messageType,
                                                       javax.swing.Icon icon,
                                                       java.lang.Object[] options,
                                                       java.lang.Object initialValue)
        Shows an JOptionPane option dialog on the screen the parent component is residing or if parent is null on the screen the mouse pointer is currently visible on.
        Parameters:
        message - The message to show.
        title - The title of the dialog.
        optionType - The JOptionPane optionType.
        messageType - The JOptionPane messageType.
        icon - The icon for the dialog.
        options - The options to choose from.
        initialValue - The selected option at first displaying the dialog.
        Returns:
        The return value of the option dialog
        Since:
        4.2.2
      • showOptionDialogOnMouseScreen

        public static int showOptionDialogOnMouseScreen​(java.lang.Object message,
                                                        java.lang.String title,
                                                        int optionType,
                                                        int messageType,
                                                        javax.swing.Icon icon,
                                                        java.lang.Object[] options,
                                                        java.lang.Object initialValue)
        Shows an JOptionPane option dialog on the screen the mouse pointer is currently visible.
        Parameters:
        message - The message to show.
        title - The title of the dialog.
        optionType - The JOptionPane optionType.
        messageType - The JOptionPane messageType.
        icon - The icon for the dialog.
        options - The options to choose from.
        initialValue - The selected option at first displaying the dialog.
        Returns:
        The return value of the option dialog
        Since:
        4.2.2