All Packages Class Hierarchy This Package Previous Next Index
Class jclass.util.JCString
java.lang.Object
|
+----java.util.Vector
|
+----jclass.util.JCVector
|
+----jclass.util.JCString
- public class JCString
- extends JCVector
JCString is a Vector used to display a combination of text and images in mixed fonts and colors.
HTML examples:
Default[COLOR=red][font=TimesRoman-ITALIC-20] red[DEFAULT_FONT][Color=orange] orange\nAn [UL]orange[/UL] line[RESET]\nWhoops\, a [STRIKETHROUGH][Color=red]mistake<
HELLO[HREF=jclass.util.JCCache.html]see cache\nnline 5[/HREF]GOODBYE\nAnother link: [HREF=file:/8/java-extra/api/javag1.htm TARGET=_top][IMAGE=images/term4.gif] see BorderLayout[/HREF]
-
ALIGN_CENTER
-
-
ALIGN_LEFT
-
-
ALIGN_RIGHT
-
-
BOTTOM
-
-
CENTER
-
-
DEFAULT_COLOR
-
-
DEFAULT_FONT
-
-
END_HREF
-
-
END_STRIKETHROUGH
-
-
END_UNDERLINE
-
-
HORIZ_SPACE
-
-
HREF
-
-
LEFT
-
-
MIDDLE
-
-
NEWLINE
-
-
RESET
-
-
RIGHT
-
-
STRIKETHROUGH
-
-
STRING_BOTTOM
-
-
STRING_LEFT
-
-
STRING_RIGHT
-
-
STRING_TOP
-
-
TOP
-
-
UNDERLINE
-
-
VERT_SPACE
-
-
JCString()
- Constructs an empty JCString with a 10-element capacity.
-
JCString(int)
- Constructs a JCString with an initial capacity.
-
JCString(String)
- Constructs a JCString with an initial String.
-
JCString(String, Image, int)
- Constructs a JCString from a String and an Image.
-
add(int)
- Adds an element.
-
add(int, Object)
- Adds an attribute and value.
-
add(Object)
- Adds an object.
-
addImage(Applet, String)
- Creates and adds an image, using a name relative to the applet through Applet.getDocumentBase().
-
addImage(Applet, String, String)
- Creates and adds an image, using the URL.
-
draw(Component, Graphics, Rectangle, int)
- Draws the JCString.
-
getApplet(Component)
- Given an AWT component, follows the component's parents until
a parent applet is found.
-
getHeight(Component, Font)
- Returns the height.
-
getImage()
- Gets the first image.
-
getLineSize(Component, Font, int, Dimension)
- Calculates the size of a particular line in a JCString.
-
getSize(Component, Font)
- Returns the size of the JCString.
-
getString()
- Concatenates all string items.
-
getURL(Applet, Object, int, int)
- Checks whether the point is within an URL stored in a JCString within the active cell.
-
getURL(int, int)
- Determines whether the point is within the HREF's URL.
-
getWidth(Component, Font)
- Returns the width.
-
parse(Component, String)
-
-
setURLoffset(int, int)
- Sets the offset for URL rectangle tracking.
-
showURL(String, AppletContext, Applet)
- If a URL is present, displays it at the specified location.
UNDERLINE
public static final Integer UNDERLINE
STRIKETHROUGH
public static final Integer STRIKETHROUGH
END_UNDERLINE
public static final Integer END_UNDERLINE
END_STRIKETHROUGH
public static final Integer END_STRIKETHROUGH
HORIZ_SPACE
public static final Integer HORIZ_SPACE
VERT_SPACE
public static final Integer VERT_SPACE
NEWLINE
public static final Integer NEWLINE
RESET
public static final Integer RESET
DEFAULT_FONT
public static final Integer DEFAULT_FONT
DEFAULT_COLOR
public static final Integer DEFAULT_COLOR
TOP
public static final Integer TOP
MIDDLE
public static final Integer MIDDLE
BOTTOM
public static final Integer BOTTOM
LEFT
public static final Integer LEFT
CENTER
public static final Integer CENTER
RIGHT
public static final Integer RIGHT
HREF
public static final Integer HREF
END_HREF
public static final Integer END_HREF
STRING_LEFT
public static final int STRING_LEFT
STRING_RIGHT
public static final int STRING_RIGHT
STRING_TOP
public static final int STRING_TOP
STRING_BOTTOM
public static final int STRING_BOTTOM
ALIGN_LEFT
public static final int ALIGN_LEFT
ALIGN_CENTER
public static final int ALIGN_CENTER
ALIGN_RIGHT
public static final int ALIGN_RIGHT
JCString
public JCString()
- Constructs an empty JCString with a 10-element capacity.
JCString
public JCString(int capacity)
- Constructs a JCString with an initial capacity.
JCString
public JCString(String s)
- Constructs a JCString with an initial String.
JCString
public JCString(String s,
Image image,
int layout)
- Constructs a JCString from a String and an Image.
- Parameters:
- layout - the relative position of the string with respect to the image:
STRING_LEFT, STRING_RIGHT, STRING_TOP or STRING_BOTTOM
add
public void add(Object o)
- Adds an object. If the object is not one of the following classes, its toString() method is called:
String Adds text
Color The text that follows is drawn using this color
Font The text that follows is drawn using this font
Image Adds an image
- Overrides:
- add in class JCVector
add
public void add(int element)
- Adds an element. Must be one of the following:
TAB Adds a tab
UNDERLINE Underlines the text that follows
END_UNDERLINE Ends the underlining of text
END_HREF Ends the underlining of text
STRIKETHROUGH The following text is struckthrough
END_STRIKETHROUGH Ends the strikethrough of text
NEWLINE Adds a newline
DEFAULT_COLOR The following text is drawn using the foreground color of the component
DEFAULT_FONT The following text is drawn using the font of the component
RESET The following text is drawn using the font and forground color of the component using default values
add
public void add(int attr,
Object value)
- Adds an attribute and value. Its attributes and accompanying value are provided below:
Attribute Value
HREF String Sets a link anchor. The string may contain a TARGET=
HORIZ_SPACE Integer Adds a horizontal space
VERT_SPACE Integer Offsets the next line by a vertical space
ALIGN TOP,MIDDLE, BOTTOM The vertical alignment within each line
parse
public static JCString parse(Component c,
String s)
getApplet
public static Applet getApplet(Component comp)
- Given an AWT component, follows the component's parents until
a parent applet is found. Returns null if no applet is found.
addImage
public boolean addImage(Applet app,
String name)
- Creates and adds an image, using a name relative to the applet through Applet.getDocumentBase(). The routine waits until the image has been downloaded.
- Returns:
- false if an error occurred
- See Also:
- getDocumentBase
addImage
public boolean addImage(Applet app,
String url,
String name)
- Creates and adds an image, using the URL. The routine waits until the image has been downloaded.
- Returns:
- false if an error occurred
getHeight
public int getHeight(Component comp,
Font default_font)
- Returns the height.
- Parameters:
- comp - this is used to obtain the default font
getWidth
public int getWidth(Component comp,
Font default_font)
- Returns the width.
- Parameters:
- comp - this is used to obtain the default font
getSize
public Dimension getSize(Component comp,
Font default_font)
- Returns the size of the JCString.
- Parameters:
- comp - this is used to obtain the default font
getLineSize
public int getLineSize(Component comp,
Font default_font,
int index,
Dimension size)
- Calculates the size of a particular line in a JCString.
- Parameters:
- comp - used to obtain and set font information
- default_font - default font to use if no font specified
- index - index of first item on the current line
- size - size information is returned inside this object
- Returns:
- index in the JCString of the first item on the next line
draw
public void draw(Component comp,
Graphics gc,
Rectangle rect,
int align)
- Draws the JCString.
- Parameters:
- comp - used to obtain the default font
- gc - the gc to be used
- rect - string drawn within the rectangle, clipped to the gc's clipRect
- align - alignment: ALIGN_LEFT, ALIGN_CENTER or ALIGN_RIGHT
setURLoffset
public void setURLoffset(int x,
int y)
- Sets the offset for URL rectangle tracking.
getURL
public String getURL(int x,
int y)
- Determines whether the point is within the HREF's URL.
getURL
public static String getURL(Applet applet,
Object value,
int x,
int y)
- Checks whether the point is within an URL stored in a JCString within the active cell.
- Parameters:
- row,col - the cell position
- x,y - the unscrolled co-ordinates
- Returns:
- the URL, or null if none was found
showURL
public static boolean showURL(String url_string,
AppletContext context,
Applet applet)
- If a URL is present, displays it at the specified location.
getString
public String getString()
- Concatenates all string items.
getImage
public Image getImage()
- Gets the first image.
All Packages Class Hierarchy This Package Previous Next Index