One Gotcha: Because initial text is
used in determining initial size, it is often the best policy
not to use showText()
as a suffix. Wait until the window
has been created and the size established. Otherwise you may get
a text area that is far too large for the screen.
- Version:
- Jul 22, 2005
- Author:
- copyright 2005 by J Adrian Zimmer
Licensed under the Open Software License version 2.1
Constructor Summary |
ZTextlines()
Creates an empty ZTextlines object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZTextlines
public ZTextlines()
- Creates an empty
ZTextlines
object.
background
public final ZTextlines background(java.awt.Color c)
- Suffix that determines the background
color of the
ZTextlines
.
- Parameters:
c
- the desired color
foreground
public final ZTextlines foreground(java.awt.Color c)
- Suffix that sets the foreground color.
This is the color of the text.
selectionBackground
public final ZTextlines selectionBackground(java.awt.Color c)
- Suffix that determines color of the area the
user has selected with the mouse.
- Parameters:
c
- the desired color
selectionForeground
public final ZTextlines selectionForeground(java.awt.Color c)
- Suffix that sets the selection's foreground color.
This is the color of text the user has
selected with the mouse.
debug
public final ZTextlines debug(java.lang.String debugId)
- Suffix that creates debug output.
- Parameters:
debugId
- a string to identify this component
in the debug output
setFont
public final ZTextlines setFont(java.awt.Font f)
- Suffix which sets the font the
label will appear in.
- Parameters:
f
- the desired font
pointSize
public final ZTextlines pointSize(int pointSize)
- Suffix which alters the
point size of the font.
- Parameters:
pointSize
- the desired point size
minSize
public final ZTextlines minSize(java.awt.Dimension minSize)
- Suffix that sets the minimum size. This suffix
adjusts the amount of screen real estate that the
ZTextlines
object will fill. The actual Dimension
allowed
is obtained by taking the largest width and height
found in any of the following: the initial text, this
suffix, the numRowCols()
suffix.
- Parameters:
minSize
- the desired size
numColsRows
public final ZTextlines numColsRows(int numColumns,
int numRows)
- Suffix that adjusts the size. Desired size
is set by establishing the approximate number of rows and
columns that can be written. This suffix adjusts
amount of screen real estate that the
ZTextlines
object will fill. The actual Dimension
allowed
is obtained by taking the largest width and height
found in any of the following: the initial text, this
suffix, the size()
suffix.
- Parameters:
numRows
- the desired number of rowsnumColumns
- the desired number of columns
expandH
public final ZTextlines expandH()
- Suffix that enables horizontal stretching.
Use this to allow your text area to be streched
in a horizontal direction when the user resizes your
window.
expandV
public final ZTextlines expandV()
- Suffix that enables horizontal stretching.
Use this to allow your text area to be streched
in a horizontal direction when the user resizes your
window.
framed
public final ZTextlines framed(int margin)
- Suffix that creates an etched frame around
the text area. Do not use with
the
sunken()
or unframed()
suffixes.
unframed
public final ZTextlines unframed(int margin)
- Suffix that creates the margin used with a frame without
creating the frame.
This margin overrides any other spacing on the sides
of the slice. Do not use with
framed()
suffix.
- Parameters:
margin
- size of margin around the text area
sunken
public final ZTextlines sunken()
- Suffix that gives the text area a sunken look.
Do not use with
the
framed()
or unframed()
suffixes.
scrollReady
public final ZTextlines scrollReady()
- Suffix that causes scrollbars to appear when
necessary.
showText
public final ZTextlines showText(java.lang.String showMe)
- Writes a
String
into the text area.
- Parameters:
showMe
- the String
to write
getSelection
public final java.lang.String getSelection()
- Fetches then substring selected by the user. This
is the string whose colors are affected by
selectionForeground()
and selectionBackground()
.
return the substring currently selected by the user.