org.jppf.ui.utils
Class GuiUtils

java.lang.Object
  extended by org.jppf.ui.utils.GuiUtils

public final class GuiUtils
extends Object

Collection of GUI utility methods.

Author:
Laurent Cohen

Constructor Summary
GuiUtils()
           
 
Method Summary
static JPanel createBoxPanel(int orientation)
          Create a chartPanel with a box layout with the specified orientation.
static JComponent createFiller(int width, int height)
          Create a filler component with the specified fixed size.
static String formatToolTipText(String tooltip)
          Format a possibly multi-line text into a a string that can be properly displayed as a tooltip..
static Frame getTopFrame(Component comp)
          Retrieve the top frame ro which a component belongs.
static ImageIcon loadIcon(String path)
          Load and cache an icon from the file system or classpath.
static ImageIcon loadIcon(String path, boolean useCache)
          Load and cache an icon from the file system or classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiUtils

public GuiUtils()
Method Detail

createBoxPanel

public static JPanel createBoxPanel(int orientation)
Create a chartPanel with a box layout with the specified orientation.

Parameters:
orientation - the box orientation, one of BoxLayout.Y_AXIS or BoxLayout.X_AXIS.
Returns:
a JPanel instance.

loadIcon

public static ImageIcon loadIcon(String path)
Load and cache an icon from the file system or classpath.

Parameters:
path - the path to the icon.
Returns:
the loaded icon as an ImageIcon instance, or null if the icon could not be loaded.

loadIcon

public static ImageIcon loadIcon(String path,
                                 boolean useCache)
Load and cache an icon from the file system or classpath.

Parameters:
path - - the path to the icon.
useCache - - specifiies whether the icon should be retrieved from and/or put in the icon cache.
Returns:
the loaded icon as an ImageIcon instance, or null if the icon could not be loaded.

createFiller

public static JComponent createFiller(int width,
                                      int height)
Create a filler component with the specified fixed size. The resulting component can be used as a separator for layout purposes.

Parameters:
width - the component's width.
height - the component's height.
Returns:
a JComponent instance.

formatToolTipText

public static String formatToolTipText(String tooltip)
Format a possibly multi-line text into a a string that can be properly displayed as a tooltip..

Parameters:
tooltip - the non-formatted text of the tooltip.
Returns:
the input text if it does not contain any line break, otherwise the input text wrapped in <html> ... </html> tags, with the line breaks transformed into <br> tags.

getTopFrame

public static Frame getTopFrame(Component comp)
Retrieve the top frame ro which a component belongs.

Parameters:
comp - the component whose frame to retrieve.
Returns:
a Frame instance if it can be found, null otherwise.


Copyright © 2005-2010 JPPF Team.