All Methods
zio package

context

zio
Class Zio


java.lang.Object

  extended byzio.Zio


public class Zio
extends java.lang.Object

The Zio class is a method defining class that contains a potpourri of methods. Some of these aid the other classes in the zio package. Others provide a one stop shopping place for beginners looking for a few simple actions to use in conjunction with the zio package.

Version:
Jul 22, 2005
Author:
copyright 2005 by J Adrian Zimmer
Licensed under the Open Software License version 2.1
See Also:
Dimension , Color

Constructor Summary
Zio()
           
 
Method Summary
static void abort(java.lang.String message)
          Writes a message in the command window, starts a new line, and aborts the program.
static boolean ask(java.lang.String question)
          Pops a window up that asks a yes/no question.
static char[] extractChars(java.lang.String str)
          Splits a String into a character array.
static java.lang.String[] extractLines(java.lang.String str)
          Splits a String into an array of lines.
static java.lang.String[] extractTokens(java.lang.String str)
          Splits a String into an array of tokens.
static java.awt.Color getGlobalBackground()
          Get the global background color.
static java.awt.Color getGlobalForeground()
          Get the global foreground color.
static java.awt.Dimension getLargestZObject()
          Finds the size of the largest ZObject that will fit on this screen with this motif.
static java.awt.Color getOriginalGlobalBackground()
          Get the default background color.
static java.awt.Color getOriginalGlobalForeground()
          Get the default foreground color.
static java.awt.Dimension getScreenSize()
          Finds the size in pixels of the current moniter.
static void registerShutdown(ZioShutdown g)
          Registers a subclass of ZioShutdown to change the actions taken under normal and abnormal shutdowns.
static void setGlobalBackground(java.awt.Color bg)
          Set the global background color.
static void setGlobalForeground(java.awt.Color fg)
          Sets the global foreground color.
static void show(java.lang.String str)
          Writes a string in the command window and starts a new line.
static void stop()
          Stops the program.
static void tell(java.lang.String message)
          Pops a window up that tells the user something.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Zio


public Zio()
Method Detail

getLargestZObject


public static final java.awt.Dimension getLargestZObject()
Finds the size of the largest ZObject that will fit on this screen with this motif.

Returns:
largest usable dimension of a ZObject

getScreenSize


public static final java.awt.Dimension getScreenSize()
Finds the size in pixels of the current moniter. If the computer executing this code has more than one monitor, the default one is used.

Returns:
a Dimension giving the screen size

getOriginalGlobalForeground


public static final java.awt.Color getOriginalGlobalForeground()
Get the default foreground color. This is the foreground color your objects will have if you do not execute. setGlobalForeground() or some relevant suffix. Foreground is the color used when printing and drawing on the screen.

Returns:
the default foreground color

getOriginalGlobalBackground


public static final java.awt.Color getOriginalGlobalBackground()
Get the default background color. This is the background color your system would give your objects if you do not execute setGlobalBackground() or some relevant suffix.


getGlobalForeground


public static final java.awt.Color getGlobalForeground()
Get the global foreground color. This color may be overriden with suffixes.

Returns:
the global foreground color

getGlobalBackground


public static final java.awt.Color getGlobalBackground()
Get the global background color. This color may be overriden with suffixes.

Returns:
the global background color

setGlobalForeground


public static final void setGlobalForeground(java.awt.Color fg)
Sets the global foreground color. This color may be overriden with suffixes; otherwise it applies to every ZObject in a ZWindow.

Parameters:
fg - a new global foreground color
See Also:
Dimension , Color

setGlobalBackground


public static final void setGlobalBackground(java.awt.Color bg)
Set the global background color. This color may be overriden with suffixes; otherwise it applies to every ZObject in a ZWindow.

Parameters:
bg - a new global background color
See Also:
Dimension , Color

registerShutdown


public static void registerShutdown(ZioShutdown g)
Registers a subclass of ZioShutdown to change the actions taken under normal and abnormal shutdowns. See the ZioShutdown class.

Parameters:
g - a subclass of ZioShutdown

show


public static final void show(java.lang.String str)
Writes a string in the command window and starts a new line. This is a String replacement for System.out.println that is included for the convenience of beginners using the InOut.readText() method.

Parameters:
str - the string to be written

abort


public static final void abort(java.lang.String message)
Writes a message in the command window, starts a new line, and aborts the program. Calls a cleanup method before aborting, see the shutdown class where you can arrange your programs to recover from errors.

Parameters:
message - the string to be written

stop


public static final void stop()
Stops the program. Calls a cleanup method before stopping, see the ZioShutdown class.


extractChars


public static final char[] extractChars(java.lang.String str)
Splits a String into a character array. This method included for the convenience of beginners using the InOut.readText() method. All characters including end of line symbols will be placed into the returned character array. Note that

new String( Zio.extractChars(str))

will return a String with the same chars in the same order as str.

Parameters:
str - a string
Returns:
an array of all the characters in str

extractLines


public static final java.lang.String[] extractLines(java.lang.String str)
Splits a String into an array of lines. Lines are returned in an array of Strings without their end of line symbols. Note an empty file or a file containing one empty line will produce an array with one empty string in it.

Parameters:
str - a string
Returns:
an array of all the lines in str

ask


public static boolean ask(java.lang.String question)
Pops a window up that asks a yes/no question.

Parameters:
question - the question to ask the user
Returns:
true if user answers "yes" and false if user answers "no" or closes the window

tell


public static void tell(java.lang.String message)
Pops a window up that tells the user something. User is presented with a message and a button that says "message seen".

Parameters:
message - a warning message

extractTokens


public static final java.lang.String[] extractTokens(java.lang.String str)
Splits a String into an array of tokens. Think of a token as a word. (Actually a token can contain punctuation characters as well as letters) This method is included for the convenience of beginners using InOut.readText().

A more careful definition of a token is that it is a string consisting of characters that are not seen as whitespace. (That means ' ', '\n', and '\t' are excluded.) This method finds all the longest possible tokens in its argument and returns them in order as an array of Strings.

Parameters:
str - a string
Returns:
an array of all the tokens in str

author
context