org.xulux.guilayer.swing.util
Class SwingUtils

java.lang.Object
  extended by org.xulux.guilayer.swing.util.SwingUtils

public class SwingUtils
extends java.lang.Object

Contains several utilities to make life with swing easier.

Version:
$Id: SwingUtils.java,v 1.1 2005/12/18 12:58:22 mvdb Exp $
Author:
Martin van den Bemt

Constructor Summary
protected SwingUtils()
          Override constructor.
 
Method Summary
static java.awt.Dimension getDimension(org.xulux.api.gui.IWidgetRectangle rectangle)
           
static javax.swing.ImageIcon getIcon(java.lang.String resource, java.lang.Object object)
           
static java.awt.Image getImage(java.lang.String resource, java.lang.Object object)
          Returns the image based on the resource.
protected static ImageLoaderInterface getImageLoader()
           
static java.awt.Insets getInsets(java.lang.String margin)
          Creates an insets object from a comma delimited string.
protected static void initializeImageLoader()
          Initializes the imageloader from system properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingUtils

protected SwingUtils()
Override constructor.

Method Detail

initializeImageLoader

protected static void initializeImageLoader()
Initializes the imageloader from system properties.


getImageLoader

protected static ImageLoaderInterface getImageLoader()
Returns:
the imagelaoder that was initialized. If the default is used (swing) than null is returned

getImage

public static java.awt.Image getImage(java.lang.String resource,
                                      java.lang.Object object)
Returns the image based on the resource. The resource should be available to the classloader, otherwize it will fail loading. It will use the ImageInterface when jimi is supported

Parameters:
resource - - the resource from the classpath
object - - the object to get the classLoader from. At this time it cannot be null
Returns:
the Image retrieved

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String resource,
                                            java.lang.Object object)
Parameters:
resource - the resource of the image
object - the object to get the classloader from
Returns:
the imageIcon found or null if not found

getDimension

public static java.awt.Dimension getDimension(org.xulux.api.gui.IWidgetRectangle rectangle)
Parameters:
rectangle - the rectangle to get the dimensions for
Returns:
the dimensions for the rectangle specified

getInsets

public static java.awt.Insets getInsets(java.lang.String margin)
Creates an insets object from a comma delimited string. If the string is incomplete null will be returned.

Parameters:
margin - - the margin in the format top,left,bottom,right
Returns:
the insets depending on the margin


Copyright © 2002-2007 Martin van den Bemt. All Rights Reserved.