Class SwingHelper


  • public final class SwingHelper
    extends java.lang.Object
    A collection of standard utility methods for use within Swing.
    • Constructor Summary

      Constructors 
      Constructor Description
      SwingHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void centerOnScreen​(java.awt.Component component)
      Centers the Component on screen.
      static void configureCancelForDialog​(javax.swing.JDialog dialog, javax.swing.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
      static void invokeOnEDT​(java.lang.Runnable runnable)  
      static boolean isMacOSX()  
      static java.util.List<javax.swing.JButton> orderOKCancelButtons​(javax.swing.JButton okButton, javax.swing.JButton cancelButton)  
      static java.io.File promptForFile​(java.awt.Container parent, java.lang.String defaultPath, java.lang.String title, boolean loadDialog)  
      • Methods inherited from class java.lang.Object

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

      • SwingHelper

        public SwingHelper()
    • Method Detail

      • centerOnScreen

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

        public static void configureCancelForDialog​(javax.swing.JDialog dialog,
                                                    javax.swing.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​(java.lang.Runnable runnable)
      • isMacOSX

        public static boolean isMacOSX()
      • orderOKCancelButtons

        public static java.util.List<javax.swing.JButton> orderOKCancelButtons​(javax.swing.JButton okButton,
                                                                               javax.swing.JButton cancelButton)
      • promptForFile

        public static java.io.File promptForFile​(java.awt.Container parent,
                                                 java.lang.String defaultPath,
                                                 java.lang.String title,
                                                 boolean loadDialog)