All Methods
zio package

context

zio
Class ZTextlines

java.lang.Object
  extended byzio.ZObject
      extended byzio.ZTextlines

public class ZTextlines
extends ZObject

A program writeable two-dimensional text area. Your program can write in this area and your user can select text within it. Your user cannot write in it. The initial size of the area remains in effect whenever the text is rewritten unless the user is able to change it because you used the expandH() or expandV() suffixes. If the initial text doesn't define as big an area as you will need later, use numRowCols() suffix and/or the minSize() suffix to ask for more. Initial text area will be the smallest which accommodates all size information provided by these suffixes and the initial text (if any).

If rewritten text does not fit in text area, it is truncated. If this is a problem use the scrollReady() suffix.

The default font can be altered with the setFont suffix and the size of the default font can be altered with the changeSize suffix. Either of these alterations will be taken into consideration when establishing the initial text area's size.

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.
 
Method Summary
 ZTextlines background(java.awt.Color c)
          Suffix that determines the background color of the ZTextlines.
 ZTextlines debug(java.lang.String debugId)
          Suffix that creates debug output.
 ZTextlines expandH()
          Suffix that enables horizontal stretching.
 ZTextlines expandV()
          Suffix that enables horizontal stretching.
 ZTextlines foreground(java.awt.Color c)
          Suffix that sets the foreground color.
 ZTextlines framed(int margin)
          Suffix that creates an etched frame around the text area.
 java.lang.String getSelection()
          Fetches then substring selected by the user.
 ZTextlines minSize(java.awt.Dimension minSize)
          Suffix that sets the minimum size.
 ZTextlines numColsRows(int numColumns, int numRows)
          Suffix that adjusts the size.
 ZTextlines pointSize(int pointSize)
          Suffix which alters the point size of the font.
 ZTextlines scrollReady()
          Suffix that causes scrollbars to appear when necessary.
 ZTextlines selectionBackground(java.awt.Color c)
          Suffix that determines color of the area the user has selected with the mouse.
 ZTextlines selectionForeground(java.awt.Color c)
          Suffix that sets the selection's foreground color.
 ZTextlines setFont(java.awt.Font f)
          Suffix which sets the font the label will appear in.
 ZTextlines showText(java.lang.String showMe)
          Writes a String into the text area.
 ZTextlines sunken()
          Suffix that gives the text area a sunken look.
 ZTextlines unframed(int margin)
          Suffix that creates the margin used with a frame without creating the frame.
 
Methods inherited from class zio.ZObject
getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZTextlines

public ZTextlines()
Creates an empty ZTextlines object.

Method Detail

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 rows
numColumns - 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.


author
context