All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.BWTUtil

java.lang.Object
   |
   +----jclass.bwt.BWTUtil

public class BWTUtil
extends Object
Various static utility routines.


Variable Index

 o CENTER
 o images
Table of double-buffer images for each thread.
 o LEFT
 o RIGHT

Constructor Index

 o BWTUtil()

Method Index

 o brighter(Color)
Calculates the color even when it is saturated, for example, when it is black or white.
 o copyList(boolean[], int, boolean)
Returns a lengthened copy of a list.
 o copyList(int[], int, int)
Returns a lengthened copy of a list.
 o copyList(Object[], int, Object)
Returns a lengthened copy of a list.
 o countChar(char[], int, char, int, int)
Counts the occurrences of the char between start and end-1.
 o countChar(String, char, int, int)
Counts the occurrences of the char between start and end-1.
 o darker(Color)
Calculates the color even when it is saturated, for example, when it is black or white.
 o draw(Component, Graphics, Object, int, Rectangle)
Draws the value as a String, JCString or Image.
 o drawDashedLine(Graphics, int, int, int, int)
Draws a dashed line.
 o drawDashedRect(Graphics, int, int, int, int)
Draws a dashed rectangle.
 o getApplet(Component)
Follows the component's parents until a parent applet is found.
 o getAppletContext(Applet)
Gets the component's applet's context.
 o getFrame(Component)
Gets the component's parent frame.
 o getHeight(Object, Component)
Gets the value's height using the component's font.
 o getHeight(Object, Component, Font)
Gets the value's height using the specified font.
 o getMouseButton(Event)
Returns the mouse button that was pressed: 1, 2, or 3 (left, middle, right)
 o getNumLines(Object)
Gets the number of newlines in the value.
 o getVisibleScreenLoc(Component, int, int, int, int)
Returns the position that ensures that the component is visible on the screen.
 o getWidth(Object, Component)
Gets the value's width using the component's font.
 o getWidth(Object, Component, Font)
Gets the value's width using the specified font.
 o getWidth(Vector, JCMultiColumnInterface)
Gets the total width of all the vector's elements.
 o inBrowser(Component)
Returns true if the component is in an applet in a browser (ie its AppletContext is not null).
 o instanceOf(Object, String)
Returns true if one of the object's superclasses' names contains the string
 o intersects(Component, int, int, int, int)
Checks whether the rectangle intersects the component.
 o isParent(Component, Component)
Returns true if the container is equal to the component, or is its parent or grandparent.
 o setCursor(Component, int)
Sets the cursor in the parent frame.
 o toHorizAlignment(int)
Gets the horizontal component of an alignment.
 o trace()
DEBUG
 o translateFromParent(Container, Component, int, int)
Translates a point in a parent's co-ordinate system to its child's.
 o translateToParent(Container, Component, int, int)
Translates a point in a child's co-ordinate system to its parent's.
 o wallPaper(Component, Graphics, Image)
Draws the image repeatedly across the component, from left to right and top to bottom.

Variables

 o images
 protected static Hashtable images
Table of double-buffer images for each thread.

 o LEFT
 public static final int LEFT
 o CENTER
 public static final int CENTER
 o RIGHT
 public static final int RIGHT

Constructors

 o BWTUtil
 public BWTUtil()

Methods

 o copyList
 public static final Object[] copyList(Object list[],
                                       int len,
                                       Object def)
Returns a lengthened copy of a list.

Parameters:
list - list to be lengthened
def - default value for new items
len - the desired new length. If the list's length is less than or equal to this value, the list is simply returned
 o copyList
 public static final int[] copyList(int list[],
                                    int len,
                                    int def)
Returns a lengthened copy of a list.

Parameters:
list - list to be lengthened
def - default value for new items
len - the desired new length. If the list's length is less than or equal to this value, the list is simply returned
 o copyList
 public static final boolean[] copyList(boolean list[],
                                        int len,
                                        boolean def)
Returns a lengthened copy of a list.

Parameters:
list - list to be lengthened
def - default value for new items
len - the desired new length. If the list's length is less than or equal to this value, the list is simply returned
 o intersects
 public static final boolean intersects(Component comp,
                                        int x,
                                        int y,
                                        int w,
                                        int h)
Checks whether the rectangle intersects the component.

 o countChar
 public static int countChar(String s,
                             char c,
                             int start,
                             int end)
Counts the occurrences of the char between start and end-1.

 o countChar
 public static int countChar(char array[],
                             int array_len,
                             char c,
                             int start,
                             int end)
Counts the occurrences of the char between start and end-1.

 o translateToParent
 public static Point translateToParent(Container parent,
                                       Component child,
                                       int x,
                                       int y)
Translates a point in a child's co-ordinate system to its parent's.

Parameters:
parent - a parent or grandparent of the child
x,y - co-ordinates in child's system
 o translateFromParent
 public static Point translateFromParent(Container parent,
                                         Component child,
                                         int x,
                                         int y)
Translates a point in a parent's co-ordinate system to its child's.

Parameters:
parent - a parent or grandparent of the child
x,y - co-ordinates in parent's system
 o getVisibleScreenLoc
 public static Point getVisibleScreenLoc(Component comp,
                                         int x,
                                         int y,
                                         int w,
                                         int h)
Returns the position that ensures that the component is visible on the screen.

Parameters:
x,y - component's location
w,h - component's size
 o getFrame
 public static Frame getFrame(Component comp)
Gets the component's parent frame.

 o getApplet
 public static Applet getApplet(Component comp)
Follows the component's parents until a parent applet is found. Returns null if no applet is found.

 o getAppletContext
 public static AppletContext getAppletContext(Applet applet)
Gets the component's applet's context. The applet context lets an applet control the applet's environment which is usually the browser or the applet viewer.

Returns:
null if the component is not in an applet or the applet is not in a browser.
See Also:
getAppletContext
 o inBrowser
 public static boolean inBrowser(Component comp)
Returns true if the component is in an applet in a browser (ie its AppletContext is not null).

 o brighter
 public static Color brighter(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.

 o darker
 public static Color darker(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.

 o instanceOf
 public static boolean instanceOf(Object obj,
                                  String name)
Returns true if one of the object's superclasses' names contains the string

 o isParent
 public static boolean isParent(Component parent,
                                Component comp)
Returns true if the container is equal to the component, or is its parent or grandparent.

 o getWidth
 public static int getWidth(Vector value,
                            JCMultiColumnInterface comp)
Gets the total width of all the vector's elements.

 o getWidth
 public static int getWidth(Object value,
                            Component comp)
Gets the value's width using the component's font.

 o getWidth
 public static int getWidth(Object value,
                            Component comp,
                            Font font)
Gets the value's width using the specified font. If the value is a Vector, the sum of all its element's widths is returned.

 o getHeight
 public static int getHeight(Object value,
                             Component comp)
Gets the value's height using the component's font. If the value is a Vector, the largest of all its element's heights is returned.

 o getHeight
 public static int getHeight(Object value,
                             Component comp,
                             Font font)
Gets the value's height using the specified font.

 o getNumLines
 public static int getNumLines(Object value)
Gets the number of newlines in the value.

 o toHorizAlignment
 public static int toHorizAlignment(int align)
Gets the horizontal component of an alignment.

Returns:
BWTUtil.LEFT, CENTER or RIGHT
 o draw
 public static synchronized void draw(Component comp,
                                      Graphics gc,
                                      Object value,
                                      int alignment,
                                      Rectangle draw_rect)
Draws the value as a String, JCString or Image.

Parameters:
alignment - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT
draw_rect - rectangle within which to draw the value
 o trace
 public static void trace()
DEBUG

 o drawDashedLine
 public static void drawDashedLine(Graphics gc,
                                   int x1,
                                   int y1,
                                   int x2,
                                   int y2)
Draws a dashed line.

 o drawDashedRect
 public static void drawDashedRect(Graphics gc,
                                   int x,
                                   int y,
                                   int w,
                                   int h)
Draws a dashed rectangle.

 o wallPaper
 public static void wallPaper(Component comp,
                              Graphics gc,
                              Image image)
Draws the image repeatedly across the component, from left to right and top to bottom.

 o getMouseButton
 public static int getMouseButton(Event ev)
Returns the mouse button that was pressed: 1, 2, or 3 (left, middle, right)

 o setCursor
 public static void setCursor(Component comp,
                              int cursor)
Sets the cursor in the parent frame.


All Packages  Class Hierarchy  This Package  Previous  Next  Index