Class GuiUtil


  • public class GuiUtil
    extends java.lang.Object
    Useful GUI utilities
    Version:
    1.7
    • Constructor Summary

      Constructors 
      Constructor Description
      GuiUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void center​(java.awt.Component componentToMove, java.awt.Component componentToCenterOn)
      Centers the first component on the second
      static void centerOnScreen​(java.awt.Component componentToMove)
      Centers the component on the screen
      static void centerOnWindow​(java.awt.Component componentToMove)
      Centers the component on its window
      static void commitChanges​(javax.swing.JTable table)  
      static void formatTooltip​(javax.swing.JComponent jcomponent)
      Changes the tooltip text of the JComponent to be multiline HTML.
      static void formatTooltips​(java.awt.Container container)
      Changes the tooltip text of each component in the Container to be multiline HTML.
      static java.io.File[] getSelectedFiles​(javax.swing.JFileChooser chooser)
      Workaround for Swing bug: JFileChooser does not support multi-file selection See Sun bug database 4218431.
      static void invokeAndWait​(java.lang.Runnable r)
      Runs r in the event dispatch thread, which may be the current thread.
      static void show​(javax.swing.JInternalFrame internalFrame, javax.swing.JDesktopPane desktopPane)
      Workaround for bug: can't re-show internal frames.
      • Methods inherited from class java.lang.Object

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

      • GuiUtil

        public GuiUtil()
    • Method Detail

      • center

        public static void center​(java.awt.Component componentToMove,
                                  java.awt.Component componentToCenterOn)
        Centers the first component on the second
      • centerOnScreen

        public static void centerOnScreen​(java.awt.Component componentToMove)
        Centers the component on the screen
      • centerOnWindow

        public static void centerOnWindow​(java.awt.Component componentToMove)
        Centers the component on its window
      • commitChanges

        public static void commitChanges​(javax.swing.JTable table)
      • show

        public static void show​(javax.swing.JInternalFrame internalFrame,
                                javax.swing.JDesktopPane desktopPane)
                         throws java.beans.PropertyVetoException
        Workaround for bug: can't re-show internal frames. See bug parade 4138031.
        Throws:
        java.beans.PropertyVetoException
      • getSelectedFiles

        public static java.io.File[] getSelectedFiles​(javax.swing.JFileChooser chooser)
        Workaround for Swing bug: JFileChooser does not support multi-file selection See Sun bug database 4218431. http://manning.spindoczine.com/sbe/files/uts2/Chapter14html/Chapter14.htm)
      • formatTooltips

        public static void formatTooltips​(java.awt.Container container)
        Changes the tooltip text of each component in the Container to be multiline HTML. Modifies all descendants (children, grandchildren, etc.).
      • formatTooltip

        public static void formatTooltip​(javax.swing.JComponent jcomponent)
        Changes the tooltip text of the JComponent to be multiline HTML.
      • invokeAndWait

        public static void invokeAndWait​(java.lang.Runnable r)
                                  throws java.lang.InterruptedException,
                                         java.lang.reflect.InvocationTargetException
        Runs r in the event dispatch thread, which may be the current thread. Waits for r to finish before returning.
        Throws:
        java.lang.InterruptedException
        java.lang.reflect.InvocationTargetException