edu.washington.cs.supple.wlib.java2
Class SwingUtils

java.lang.Object
  extended byedu.washington.cs.supple.wlib.java2.SwingUtils

public class SwingUtils
extends java.lang.Object

Author:
kgajos

Field Summary
protected static java.awt.image.BufferedImage buffer
           
protected static java.awt.Graphics2D graphics
           
 
Constructor Summary
SwingUtils()
           
 
Method Summary
static javax.swing.JLabel createJLabel(java.io.Serializable label)
           
static java.util.Vector getSameRenderingObjects(UiObject obj)
          Returns a vector of other objects (exluding self) that are constrained to be rendered the same way
static javax.swing.JComponent getSwingComponentWithContextMenu(javax.swing.JComponent c, SwingWidget w)
          Connects a swing widget to mouse listeners and transfer handlers, so that customization commands can be performed
static javax.swing.JComponent getSwingComponentWithContextMenu(SwingWidget w, int hints)
          Connects a swing widget to mouse listeners and transfer handlers, so that customization commands can be performed
static java.lang.String getTypicalString(int length)
          Produces a "typical" string of a given length
static java.util.Vector getTypicalStringList(int length, int number)
          Produces an array of "typical" strings of a given length
static java.awt.geom.Rectangle2D getTypicalStringSize(int length, java.awt.Font font)
          Returns the size of the "typical" string of a given lenght as rendered using a particular font
static UiObject getUiObjectOfJComponent(javax.swing.JComponent component)
          Returns the UiObject that is connected to a JComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected static java.awt.image.BufferedImage buffer

graphics

protected static java.awt.Graphics2D graphics
Constructor Detail

SwingUtils

public SwingUtils()
Method Detail

createJLabel

public static javax.swing.JLabel createJLabel(java.io.Serializable label)

getTypicalString

public static java.lang.String getTypicalString(int length)
Produces a "typical" string of a given length

Parameters:
length - the lenght for the string
Returns:
the "typical" string of a given length

getTypicalStringSize

public static java.awt.geom.Rectangle2D getTypicalStringSize(int length,
                                                             java.awt.Font font)
Returns the size of the "typical" string of a given lenght as rendered using a particular font

Parameters:
length - the lenght
font - font
Returns:
size of the resulting string as it will be displayed on the screen

getTypicalStringList

public static java.util.Vector getTypicalStringList(int length,
                                                    int number)
Produces an array of "typical" strings of a given length

Parameters:
length - the lenght for the string
number - How many strings should be returned in the collection
Returns:
the "typical" string of a given length

getSwingComponentWithContextMenu

public static javax.swing.JComponent getSwingComponentWithContextMenu(SwingWidget w,
                                                                      int hints)
Connects a swing widget to mouse listeners and transfer handlers, so that customization commands can be performed

Parameters:
w -

getSwingComponentWithContextMenu

public static javax.swing.JComponent getSwingComponentWithContextMenu(javax.swing.JComponent c,
                                                                      SwingWidget w)
Connects a swing widget to mouse listeners and transfer handlers, so that customization commands can be performed

Parameters:
w -

getUiObjectOfJComponent

public static UiObject getUiObjectOfJComponent(javax.swing.JComponent component)
Returns the UiObject that is connected to a JComponent. This method only returns the UiObject, if it has been connected, i.e. the method above was used to create the JComponent.

Parameters:
component -
Returns:

getSameRenderingObjects

public static java.util.Vector getSameRenderingObjects(UiObject obj)
Returns a vector of other objects (exluding self) that are constrained to be rendered the same way

Parameters:
obj -
Returns: