br.usp.ime.klava.segmentit.util
Class GUIUtils

java.lang.Object
  extended by br.usp.ime.klava.segmentit.util.GUIUtils

public class GUIUtils
extends java.lang.Object

Provides utility methods to be used in GUI elements.

Author:
Bruno Klava

Constructor Summary
GUIUtils()
           
 
Method Summary
static void addKeyListenerRecursively(java.awt.Component component, java.awt.event.KeyListener listener)
          Adds the given keyListener listener to the component and to all its children recursively.
static javax.swing.ImageIcon getIcon(java.lang.String iconFilename)
          Returns an ImageIcon containing the image stored in iconFilename.
static java.lang.String toHTMLString(java.lang.String originalMessage)
          Formats the originalMessage as HTML to be used in Swing components.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIUtils

public GUIUtils()
Method Detail

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String iconFilename)
Returns an ImageIcon containing the image stored in iconFilename.

Parameters:
iconFilename - the name of the file to be loaded
Returns:
an ImageIcon containing the image stored in iconFilename

addKeyListenerRecursively

public static void addKeyListenerRecursively(java.awt.Component component,
                                             java.awt.event.KeyListener listener)
Adds the given keyListener listener to the component and to all its children recursively.

Parameters:
component - the component that will receive the keyListener
listener - the listener to be added to component

toHTMLString

public static java.lang.String toHTMLString(java.lang.String originalMessage)
Formats the originalMessage as HTML to be used in Swing components. The new line characters are replaced by <br> tags and the whole message is surrounded by the <html> and </html> pair of tags.

Parameters:
originalMessage - the message to be formatted as HTML
Returns:
the originalMessage formatted as HTML