org.jcon.util
Class GenLib

java.lang.Object
  extended by org.jcon.util.GenLib

public class GenLib
extends java.lang.Object

General library methods. These are all static. Those methods that many classes commonly call should be in this class, so that they only have to import GenLib. Note - Some commented out since not yet used, may be moved.

Author:
Jack Harich

Constructor Summary
GenLib()
           
 
Method Summary
static void beep()
           
static java.awt.Font createBoldFont(java.awt.Component comp, boolean isBold)
          Returns a new Font like the component's font in either bold or plain style.
static java.lang.Object createInstance(java.lang.String className)
          Creates and returns a class instance given className.
static void error(java.lang.String method, java.lang.String message)
          This method is used for logical coding errors, such as attempts to pass invalid arguments.
static java.lang.String getClassLastName(java.lang.Object instance)
           
static java.lang.String getPackageName(java.lang.String className)
          Returns the package name from the full className, for example "COM.hjac.beans.TestBean" returns "COM.hjac.beans".
static java.awt.Font makeBold(java.awt.Font font)
           
static java.lang.String readInputLine(java.lang.String prompt)
          For prompted pause in DOS window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenLib

public GenLib()
Method Detail

beep

public static void beep()

error

public static void error(java.lang.String method,
                         java.lang.String message)
This method is used for logical coding errors, such as attempts to pass invalid arguments.

Parameters:
method - should be of the format "ClassName.methodName()".
message - should describe the problem in a manner useful to both user and developer;

getPackageName

public static java.lang.String getPackageName(java.lang.String className)
Returns the package name from the full className, for example "COM.hjac.beans.TestBean" returns "COM.hjac.beans". Returns null if no package name is apparent.


createInstance

public static java.lang.Object createInstance(java.lang.String className)
Creates and returns a class instance given className. The class must have a no-arg constructor. Complains and returns null for failure.


readInputLine

public static java.lang.String readInputLine(java.lang.String prompt)
For prompted pause in DOS window. Pressing ENTER will cause the paused program to continue. Returns the text entered, which may be empty.


getClassLastName

public static java.lang.String getClassLastName(java.lang.Object instance)

createBoldFont

public static java.awt.Font createBoldFont(java.awt.Component comp,
                                           boolean isBold)
Returns a new Font like the component's font in either bold or plain style. This can be used to set a component's font to bold or plain easily.


makeBold

public static java.awt.Font makeBold(java.awt.Font font)