Class SwingHelper


  • public final class SwingHelper
    extends Object
    A collection of standard utility methods for use within Swing.
    Author:
    Paul Smith <psmith@apache.org>
    • Constructor Detail

      • SwingHelper

        public SwingHelper()
    • Method Detail

      • centerOnScreen

        public static void centerOnScreen​(Component component)
        Centers the Component on screen.
        Parameters:
        component -
      • configureCancelForDialog

        public static void configureCancelForDialog​(JDialog dialog,
                                                    JButton cancelButton)
        This method configures a standard Cancel action, bound to the ESC key, to dispose of the dialog, and sets the buttons action to be this action, and adds the action to the dialog's rootPane action map
        Parameters:
        dialog -
        cancelButton -
      • invokeOnEDT

        public static void invokeOnEDT​(Runnable runnable)
      • isMacOSX

        public static boolean isMacOSX()
      • promptForFile

        public static File promptForFile​(Container parent,
                                         String defaultPath,
                                         String title,
                                         boolean loadDialog)