Webber: A Website Construction Application


The library Package

Description

A varied collection of classes for general use.

Class Index

 AreaLabel                    Multi-line label component.
 CommonDialog                 General-purpose dialog windows.
 DefaultWindow                Closeable window
 DrawStringBuffer             Output-cache for the Graphics.drawString() method.
 GraphicsBuffer               Hidden double-buffer for graphics output.
 Lib                          Dump for various general-purpose methods.
 LinkList                     Implementation of a linked-list structure.
 MainWindow                   Main program window.
 PolyMenuWindow               Window for a multi-window program with a Window menu.
 PolyWindow                   Window for a multi-window program.

AreaLabel

Synopsis

Class Name:                   library.AreaLabel
Superclass:                   java.awt.Component
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

A multi-line label component that wraps text to fit within the area defined by its insets. An AreaLabel is used by a CommonDialog component to display the text of a message.

Class Summary

public class library.AreaLabel extends java.awt.Component {
     // Constructors
     public AreaLabel();
     public AreaLabel(String text);

     // Instance Methods
     public Insets getInsets();
     public void paint(Graphics g);
     public void setText(String text);
}

Constructors

AreaLabel

 public AreaLabel()
  Description  Creates an AreaLabel object containing no text.
 public AreaLabel(String text)
  Parameters   text      The text for the label.
  Description  Creates an AreaLabel object containing the specified text.

Instance Methods

getInsets

 public Insets getInsets()
  Returns      An Insets object holding the sizes of the left, top, right and bottom margins.
  Description  The Insets object returned by this method specifies the margins to use when
               aligning text within this AreaLabel.  The default dimensions (10, 10, 10, 10)
               can be changed by overriding this method.
paint

 public void paint(Graphics g)
  Parameters   g         A graphics context for drawing.
  Overrides    Component.paint(Graphics)
  Description  Retrieves the margins for the AreaLabel using getInsets(), clips the graphics
               context to those margins and draws the current text using Lib.drawStringWrap().
setText

 public void setText(String text)
  Parameters   text      The new text for this AreaLabel.
  Description  The text passed to this method replaces the current text of the label.

CommonDialog

Synopsis

Class Name:                   library.CommonDialog
Superclass:                   java.awt.Dialog
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

A general-purpose common dialog window similar to the CommonDialog component included with Visual Basic. Presents the user with a window containing a message and one or more options to select from. Once an option is selected, the dialog is closed and the response is returned.

Class Summary

public class library.CommonDialog extends java.awt.Dialog {
     // Constants
     public static final int OK;
     public static final int YES_NO;
     public static final int YES_NO_CANCEL;
     public static final int YES;
     public static final int NO;
     public static final int CANCEL;

     // Constructor
     public CommonDialog(Frame parent, String title, boolean modal);

     // Class Methods
     public static int getDialog(Frame parent, String title, String text);
     public static int getDialog(Frame parent, String title, String text,
                                 int type, boolean modal);

     // Instance Methods
     public Dimension getButtonGaps();
     public Insets getButtonInsets();
     public String[] getButtonLabels(int type);
     public int getResponse();
     public Dimension getStartSize();
     public void setRelative(boolean isRelative);
     public void setText(String text);
     public void setType(int type);
     public void show();
}

Constants

OK

 public static final int OK
  Constant for specifying a dialog with an 'OK' button.
YES_NO

 public static final int YES_NO
  Constant for specifying a dialog with 'YES' and 'NO' buttons.
YES_NO_CANCEL

 public static final int YES_NO_CANCEL
  Constant for specifying a dialog with 'YES', 'NO' and 'CANCEL' buttons.
YES

 public static final int YES
  Constant returned by a dialog to indicate a 'YES' or 'OK' response.
NO

 public static final int NO
  Constant returned by a dialog to indicate a 'NO' response.
CANCEL

 public static final int CANCEL
  Constant returned by a dialog to indicate a 'CANCEL' response.

Constructor

CommonDialog

 public CommonDialog(Frame parent, String title, boolean modal)
  Parameters   parent         Frame that is to act as the parent of CommonDialog.
               title          Initial title to use for the dialog window.
               modal          true if the dialog is modal, otherwise false.
  Description  Constructs a CommonDialog with the given characteristics.

Class Methods

getDialog

 public static int getDialog(Frame parent, String title, String text)
  Parameters   parent         Frame that is to act as the parent of CommonDialog.
               title          Title to use for the dialog window.
               text           Text to use as the message for this dialog.
  Returns      The value of one of the constants that indicate the response to a dialog.
  Description  Displays a modal CommonDialog with the given characteristics and 'YES',
               'NO' and 'CANCEL' buttons and returns the user's response.
 public static int getDialog(Frame parent, String title, String text,
                             int type, boolean modal)
  Parameters   parent         Frame that is to act as the parent of CommonDialog.
               title          Title to use for the dialog window.
               text           Text to use as the message for this dialog.
               type           The value of one of the constants indicating the dialog type.
               modal          true if the dialog is modal, otherwise false.
  Returns      The value of one of the constants that indicate the response to a dialog.
  Description  Displays a CommonDialog with the given characteristics and returns the user's
               response.

Instance Methods

getButtonGaps

 public Dimension getButtonGaps()
  Returns      A Dimension object containing the sizes for the button-spacing gaps.
  Description  This method is called during CommonDialog construction to obtain the vertical
               and horizontal spacing between buttons.
getButtonInsets

 public Insets getButtonInsets()
  Returns      An Insets object containing the sizes of the left, top, right and bottom
               margins around buttons.
  Description  This method is called during CommonDialog construction to obtain the margins
               to use around buttons.
getButtonLabels

 public String[] getButtonLabels(int type)
  Parameters   type      The type of dialog for which to return button labels.
  Returns      An array of strings to use as button labels.
  Description  This method is called during CommonDialog construction to obtain labels for
               buttons. The size of the returned array determines the number of buttons.
getResponse

 public int getResponse()
  Returns The value of one of the constants that indicate the user's response to a dialog.
  Description  Returns the user's response to the dialog after it has been closed.
getStartSize

 public Dimension getStartSize()
  Returns      A Dimension object holding the initial width and height of the dialog window.
  Description  This method is called during CommonDialog construction to obtain initial size
               of the dialog window.
setRelative

 public void setRelative(boolean isRelative)
  Parameters   isRelative     true if dialog is to be located relative to the parent Frame.
  Description  If isRelative is true, the centre of the dialog window will be located at
               the centre of the parent Frame, otherwise it is located at the centre of the
               screen.
setText

 public void setText(String text)
  Parameters   text           The text to use as the message for the dialog.
  Description  Changes the text of the message displayed by the dialog.
setType

 public void setType(int type)
  Parameters   type           The value of one of the constants indicating the dialog type.
  Description  Selects the type of dialog to display.
show

 public void show()
  Overrides    Dialog.show()
  Description  If the dialog is not visible, it is constructed using the current settings and
               then displayed. If the dialog is already visible, this method brings it to the
               front.

DefaultWindow

Synopsis

Class Name:                   library.DefaultWindow
Superclass:                   java.awt.Frame
Immediate Subclasses:         library.MainWindow, library.PolyWindow
Interfaces Implemented:       java.awt.WindowListener

Description

A simple extension to a Frame that implements default handlers for the window events and disposes of the window (via the windowClosing() event) when the user selects an option to close it.

Class Summary

public class library.DefaultWindow extends java.awt.Frame
  implements java.awt.event.WindowListener {
     // Constructor
     public DefaultWindow(String title);

     // Instance Methods
     public void windowActivated(WindowEvent e);
     public void windowClosed(WindowEvent e);
     public void windowClosing(WindowEvent e);
     public void windowDeactivated(WindowEvent e);
     public void windowDeiconified(WindowEvent e);
     public void windowIconified(WindowEvent e);
     public void windowOpened(WindowEvent e);
}

Constructor

DefaultWindow

 public DefaultWindow(String title)
  Parameters   title          The title to use for this window.
  Description  Constructs a hidden DefaultWindow with the specified title.

Instance Methods

windowActivated

 public void windowActivated(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the window is activated.  It does nothing.
windowClosed

 public void windowClosed(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the window is closed.  It does nothing.
windowClosing

 public void windowClosing(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the user selects an option to close the window.
               It disposes of the window and results in a call to windowClosed().
windowDeactivated

 public void windowDeactivated(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the window is Deactivated.  It does nothing.
windowDeiconified

 public void windowDeiconified(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the minimized window is restored.  It does nothing.
windowIconified

 public void windowIconified(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the window is minimized.  It does nothing.
windowOpened

 public void windowOpened(WindowEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when the window is opened.  It does nothing.

DrawStringBuffer

Synopsis

Class Name:                   library.DrawStringBuffer
Superclass:                   None
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

An implementation of an output cache for Graphics.drawString(). Reduces the number of calls to drawString() by caching consecutive blocks of text output in an internal string buffer.

Class Summary

public static class library.DrawStringBuffer {
     // Instance Methods
     public void drawString(String s, int x, int y, Graphics g);
     public void flush();
}

Instance Methods

drawString

 public void drawString(String s, int x, int y, Graphics g)
  Parameters   s         A string to be written to the internal string buffer.
               x         The coordinate for the left-end of the final string.
               y         The coordinate for the top of the final string.
               g         The Graphics context on which to draw the contents of the buffer.
  Description  If the internal buffer is empty, the x, y and g parameters are stored and
               a new buffer containing the given string is created.  If the buffer is not
               empty, the given string is appended and all other parameters are ignored.
flush

 public void flush()
  Description  Writes the entire contents of the internal buffer to the Graphics context
               and coordinates specified when the current buffer was created.  The buffer
               is then emptied.  Nothing happens if the buffer is already empty.

GraphicsBuffer

Synopsis

Class Name:                   library.GraphicsBuffer
Superclass:                   None
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

An implementation of a double-buffer for use with the Graphics context of a Component. Allows graphics output to be prepared on a hidden Graphics context and then displayed when complete.

Class Summary

public static class library.GraphicsBuffer {
     // Instance Methods
     public void crop(int xoff, int yoff);
     public void crop(int xoff, int yoff, Color color);
     public Graphics getGraphics(Component c);
     public Graphics getGraphics(Component c, Graphics g);
     public Graphics getGraphics(Component c, Rectangle r, Graphics g);
     public void paint();
     public void paint(int xoff, int yoff);
}

Instance Methods

crop

 public void crop(int xoff, int yoff)
  Parameters   xoff           The horizontal offset at which the hidden context was painted.
               yoff           The vertical offset at which the hidden context was painted.
  Description  This method clears to the component's background colour any areas not covered
               after the contents of the hidden graphics context have been painted by calling
               paint() with the specified offsets.
 public void crop(int xoff, int yoff, Color color)
  Parameters   xoff           The horizontal offset at which the hidden context was painted.
               yoff           The vertical offset at which the hidden context was painted.
               color          The colour to use for clearing.
  Description  This method clears to the given colour any areas not covered after the hidden
               graphics context has been painted using the specified offsets.
getGraphics

 public Graphics getGraphics(Component c)
  Parameters   c              A Component for which a hidden Graphics context is required.
  Returns      A hidden Graphics context.
  Description  Creates and returns a hidden Graphics context on which graphics output for
               the specified Component can be prepared.
 public Graphics getGraphics(Component c, Graphics g)
  Parameters   c              A Component for which a hidden Graphics context is required.
               g              The component's visible Graphics context.
  Returns      A hidden Graphics context.
  Description  Creates and returns a hidden Graphics context on which graphics output for
               the specified Component can be prepared.  The final output is displayed on
               the given Graphics context.
 public Graphics getGraphics(Component c, Rectangle r,Graphics g)
  Parameters   c              A Component for which a hidden Graphics context is required.
               r              A Rectangle specifying a clip-area for the Graphics context.
               g              The component's visible Graphics context.
  Returns      A hidden Graphics context.
  Description  Creates and returns a hidden Graphics context for the specified area of the
               given context on which graphics output for the specified Component can be
               prepared.  The final output is displayed on the Graphics context provided.
paint

 public void paint()
  Description  Copies the contents of the hidden Graphics context to the visible context.
 public void paint(int xoff, int yoff)
  Parameters   xoff           The horizontal offset at which to place graphics output.
               yoff           The vertical offset at which to place graphics output.
  Description  Copies the contents of the hidden Graphics context to the visible context
               with the specified offsets.  Any areas of the display not covered by the
               output at the new location are not affected (see the crop() method).

Lib

Synopsis

Class Name:                   library.Lib
Superclass:                   None
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

A general dump for class methods which are not specifically tied to any particular application.

Class Summary

public class library.Lib {
     // Class Methods
     public static void addMenuListener(Menu menu, ActionListener a);
     public static void drawStringWrap(String s, Graphics g);
     public static void fillArea(int x, int y, int w, int h, Color color, Graphics g);
     public static String getCanonicalPath(String basepath, String filename);
     public static String getDelimitedString(String s, int pos, char start, char end);
     public static String getFilename(FileDialog f, String filename);
     public static Frame getFrame(Component c);
     public static MenuItem getMenuItem(Menu menu, String command);
     public static String getQuotedString(String s, int pos);
     public static int getStringIndex(String[] array, String s);
     public static int getStringIndex(String[] array, String s, boolean ignoreCase);
     public static String getUrlFilename(URL url);
     public static String getUrlFilename(URL url, String defaultName);
     public static char[] loadCharFile(String fname);
     public static char[] loadCharStream(InputStream i);
     public static char[] loadCharStream(InputStream i, int bufsize);
     public static Button newButton(String label, String command, ActionListener a);
     public static MenuItem newMenuItem(String label, String command, ActionListener a);
     public static int nextChar(char[] chars, int pos, char c);
     public static void removeMenuListener(Menu menu, ActionListener a);
     public static void saveCharFile(String fname, char[] chars);
     public static void setFontSize(Component c, int size);
     public static int skipWhitespace(char[] chars, int pos);
}

Class Methods

addMenuListener

 public static void addMenuListener(Menu menu, ActionListener a)
  Parameters   menu           The menu to add the ActionListener to.
               a              The ActionListener object to be added to the menu.
  Description  Adds an ActionListener object to all MenuItem objects contained by a Menu.
drawStringWrap

 public static void drawStringWrap(String s, Graphics g)
  Parameters   s              A string to be drawn.
               g              A graphics context for drawing.
  Description  Draws the string wrapped to fit within the clip-area of the graphics context.
fillArea

 public static void fillArea(int x, int y, int w, int h, Color color, Graphics g)
  Parameters   x              The left-coordinate of the area to fill.
               y              The top-coordinate of the area to fill.
               w              The width of the area to fill.
               h              The height of the area to fill.
               color          The colour to fill the area with.
               g              A graphics context for drawing.
  Description  This method saves the current drawing colour for the graphics context, sets
               the drawing colour to color and fills the specified area and then restores
               the original drawing colour.
getCanonicalPath

 public static String getCanonicalPath(String basepath, String name)
  Parameters   basepath       A string containing a default directory path.
               name           A filename which is to be resolved.
  Returns      A fully resolved pathname string.
  Description  Returns a new string containing the fully resolved path to the given filename.
               If the filename is a relative file-specification, it is appended to the path
               contained by basepath.  All file-separator characters are converted to the
               character used by the current Java platform (eg. '/' in Unix, '\' in Windows).
               If any errors occur while accessing the local file-system, null is returned.
getDelimitedString

 public static String getDelimitedString(String s, int pos, char start, char end)
  Parameters   s              A string containing delimited text.
               pos            The index at which to start searching for the start delimiter.
               start          The character to interpret as the starting delimiter.
               end            The character to interpret as the ending delimiter.
  Returns      A string containing the text between the given delimiters.
  Description  This method first searches the given string from character position pos for
               the specified start character.  It then returns a new string containing all
               text after that character up to (but not including) the specified ending
               character.  If either of the starting or ending characters is not found, null
               is returned.
getFilename

 public static String getFilename(FileDialog f, String filename)
  Parameters   f              A file-dialog to present to the user.
               filename       The initial filename to use in the file-dialog.
  Returns      The full path to a file which has been entered or selected by the user.
  Description  Presents a file-dialog window to the user and returns the path to the entered
               or selected filename.  Returns null if the user cancels the file-dialog.
getFrame

 public static Frame getFrame(Component c)
  Parameters   c              A component whose containing Frame is to be located.
  Returns      A reference to the Frame containing the specified component.
  Description  Locates the containing Frame of a Component by recursively calling the
               getParent() method of the component.  A reference to the Frame is returned.
               If the component is not contained by a Frame, null is returned.
getMenuItem

 public static MenuItem getMenuItem(Menu menu, String command)
  Parameters   menu           A Menu object to be searched.
               command        The action command of the target menu item.
  Returns      A reference to the menu item containing the specified action command.
  Description  This method searches the MenuItem objects in a Menu and returns a reference
               to the item with a given action command.  If no matching menu item is found,
               null is returned.
getQuotedString

 public static String getQuotedString(String s, int pos)
  Parameters   s              A string containing quoted text.
               pos            The index at which to start searching for the first quote.
  Returns      A string containing the quoted text.
  Description  This method returns the text between the next pair of double-quote characters.
               If a pair of double-quote characters is not found, null is returned.
getStringIndex

 public static int getStringIndex(String[] array, String s)
  Parameters   array          An array of strings to be searched.
               s              The target string to be located in the array.
  Returns      The index of a string in array.
  Description  Returns the index of a string in array which exactly matches the given string.
               If the target string is not found, -1 is returned.
 public static int getStringIndex(String[] array, String s, boolean ignoreCase)
  Parameters   array          An array of strings to be searched.
               s              The target string to be located in the array.
               ignoreCase     true if letter-case should be ignored, otherwise false.
  Returns      The index of a string in array.
  Description  Returns the index of a string in array which matches the given string,
               ignoring letter-case.  If the target string is not found, -1 is returned.
getUrlFilename

 public static String getUrlFilename(URL url)
  Parameters   url            The URL of a file.
  Returns      The filename contained by the specified URL.
  Description  Returns the name of the file referred to by a URL, excluding the protocol,
               host, directory and anchor (reference) specifications.  Returns a zero-length
               string if no filename is specified.
 public static String getUrlFilename(URL url, String defaultName)
  Parameters   url            The URL of a file.
               defaultName    A default filename.
  Returns      The filename contained by the specified URL.
  Description  Returns the name of the file referred to by a URL, excluding the protocol,
               host, directory and anchor (reference) specifications.  Returns defaultName
               if no filename is specified.
loadCharFile

 public static char[] loadCharFile(String fname)
  Parameters   fname          The name of a file to load.
  Returns      A character array containing the contents of the named file.
  Throws       IOException    If any I/O errors occur while reading the file.
  Description  Creates and returns a character array containing the contents of the named
               file.
loadCharStream

 public static char[] loadCharStream(InputStream i)
  Parameters   i              An InputStream to read characters from.
  Returns      A character array containing the data from the InputStream.
  Throws       IOException    If any I/O errors occur while reading the file.
  Description  Creates and returns a character array containing all data from an InputStream.
 public static char[] loadCharStream(InputStream i, int bufsize)
  Parameters   i              An InputStream to read characters from.
               bufsize        The size to use for the internal input-buffer.
  Returns      A character array containing the data from the InputStream.
  Throws       IOException    If any I/O errors occur while reading the file.
  Description  Creates and returns a character array containing all data from an InputStream.
               Data is read from the InputStream in blocks of bufsize characters.
newButton

 public static Button newButton(String label, String command, ActionListener a)
  Parameters   label          The initial label to use for the button.
               command        The action command string for the button.
               a              An ActionListener to receive button-press events.
  Returns      A new Button object with the given characteristics.
  Description  Creates and returns a new Button with the specified label, action command
               and handler for button-press events.
newMenuItem

 public static MenuItem newMenuItem(String label, String command, ActionListener a)
  Parameters   label          The initial label to use for the menu item.
               command        The action command string for the menu item.
               a              An ActionListener to receive item-selection events.
  Returns      A new MenuItem object with the given characteristics.
  Description  Creates and returns a new MenuItem with the specified label, action command
               and handler for item-selection events.
nextChar

 public static int nextChar(char[] chars, int pos, char c)
  Parameters   chars          An array of characters to search.
               pos            The character position at which to start the search.
               c              The character to search for.
  Returns      The index of a character matching c.
  Description  Returns the index of the next character c at or after position pos in chars.
               If c is not found, the total length of the array is returned.
removeMenuListener

 public static void removeMenuListener(Menu menu, ActionListener a)
  Parameters   menu           The menu to remove the ActionListener from.
               a              The ActionListener object to be removed from the menu.
  Description  Removes an ActionListener object from all MenuItem objects contained by a Menu.
saveCharFile

 public static void saveCharFile(String fname, char[] chars)
  Parameters   fname          The name of a file to write to.
               chars          The character array to be saved.
  Throws       IOException    If any I/O errors occur while writing the file.
  Description  Writes the entire contents of a character array to a specified filename.
setFontSize

 public static void setFontSize(Component c, int size)
  Parameters   c              The component whose font is to be changed.
               size           The new size for the component's font.
  Description  This method changes the size of the font for the specified component to size.
skipWhitespace

 public static int skipWhitespace(char[] chars, int pos)
  Parameters   chars          An array of characters to search.
               pos            The character position at which to start the search.
  Returns      The index of a non-whitespace character.
  Description  Returns the index of the next non-whitespace character at or after position
               pos in chars.  If c is not found, the total length of the array is returned.

LinkList

Synopsis

Class Name:                   library.LinkList
Superclass:                   None
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

The LinkList class implements a growable list of objects. New links are individually created as required (not allocated in advance as in java.util.Vector).

Class Summary

public class library.LinkList {
     // Constructor
     public LinkList();

     // Instance Methods
     public final synchronized void addElement(Object object);
     public final synchronized void addElementAt(Object object, int index);
     public final synchronized void addLinksAt(LinkList list, int index);
     public final synchronized Object elementAt(int index);
     public final synchronized Enumeration elements();
     public final ObjectLink objects();
     public final synchronized void removeAllElements();
     public final synchronized void removeElement(Object object);
     public final synchronized void removeElementAt(int index);
     public final synchronized void removeLinksAt(int index, int num);
     public final int size();
}

Constructor

LinkList

 public LinkList()
  Description  Creates a new LinkList object containing no elements.

Instance Methods

addElement

 public final synchronized void addElement(Object object)
  Parameters   object         An object to be appended to this list.
  Description  Adds a link containing the given Object to the end of this list.
addElementAt

 public final synchronized void addElementAt(Object object, int index)
  Parameters   object         An object to be added to this list.
               index          The list-index at which to insert this object.
  Description  Inserts a link containing object into this list at the specified index.
               The object is not added if the index is out of range.
addLinksAt

 public final synchronized void addLinksAt(LinkList list, int index)
  Parameters   list           The LinkList to be inserted into this list.
               index          The list-index at which to insert the new list.
  Description  Inserts the given LinkList into this list at the specified index.
               The list is not added if the index is out of range.
elementAt

 public final synchronized Object elementAt(int index)
  Parameters   index          The list-index of the required element.
  Description  Returns the Object reference contained by the link at the specified
               list-index.  If the index is out of range, null is returned.
elements

 public final synchronized Enumeration elements()
  Returns      An Enumeration to use for stepping through the elements in this list.
  Description  This method creates and returns an Enumeration object which can be used
               to iterate through the elements of this list.
objects

 public final ObjectLink objects()
  Returns      A reference to the head of the ObjectLink list.
  Description  Returns a reference to the ObjectLink list contained by this LinkList.
removeAllElements

 public final synchronized void removeAllElements()
  Description  Removes all elements from the list contained by this LinkList.
removeElement

 public final synchronized void removeElement(Object object)
  Parameters   object         The object to be removed from this list.
  Description  Removes the first link containing the specified object (if any) from this list.
removeElementAt

 public final synchronized void removeElementAt(int index)
  Parameters   index          The list-index of the link to remove from this list.
  Description  Removes the link at the specified index from this list.  Nothing happens if
               the specified index is out of range.
removeLinksAt

 public final synchronized void removeLinksAt(int index, int num)
  Parameters   index          The list-index of the first link to remove from this list.
               num            The number of consecutive links to remove.
  Description  This method removes a given number of links from the list starting at a
               specified index.  Nothing happens if the index is out of range or there are
               less than num links at that index.
size

 public final int size()
  Returns      The size of this list.
  Description  Returns the total number of elements in this list.

MainWindow

Synopsis

Class Name:                   library.MainWindow
Superclass:                   library.DefaultWindow
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

An extension of DefaultWindow that terminates the Java system when the window is closed.

Class Summary

public class library.MainWindow extends library.DefaultWindow {
     // Constructor
     public MainWindow(String title);
     
     // Instance Methods
     public void windowClosed(WindowEvent e);
}

Constructor

MainWindow

 public MainWindow(String title)
  Parameters   title          The title to use for this window.
  Description  Constructs a hidden MainWindow with the specified title.

Instance Method

windowClosed

 public void windowClosed(WindowEvent e)
  Parameters   e              The event that has occurred.
  Overrides    DefaultWindow.windowClosed(WindowEvent)
  Description  This method is called when the window is closed. It terminates the Java system.

PolyMenuWindow

Synopsis

Class Name:                   library.PolyMenuWindow
Superclass:                   library.PolyWindow
Immediate Subclasses:         None
Interfaces Implemented:       None

Description

An extension of PolyWindow that adds a Window menu to the menu-bar of the current window. The menu lists the active windows and allows a window to be selected and activated.

Class Summary

public class library.PolyMenuWindow extends library.PolyWindow
  implements java.awt.event.ActionListener {
     // Constructor
     public PolyMenuWindow(String title);

     // Instance Methods
     public void actionPerformed(ActionEvent e);
     public void addMenu(Menu menu);
     public MenuBar getMenuBar();
     public String getMenuName();
     public void setTitle(String title);
     public void windowActivated(WindowEvent e);
     public void windowClosed(WindowEvent e);
     public void windowDeactivated(WindowEvent e);
}

Constructor

PolyMenuWindow

 public PolyMenuWindow(String title)
  Parameters   title          The title to use for this window.
  Description  Constructs a PolyMenuWindow with the given title and adds it to the
               Window menu.

Instance Methods

ActionPerformed

 public void actionPerformed(ActionEvent e)
  Parameters   e              The event that has occurred.
  Description  This method is called when a window is selected from the Window menu.
               It brings the selected window to the foreground.
addMenu

 public void addMenu(Menu menu)
  Parameters   menu           A Menu component to add to this window's menu-bar.
  Description  Adds a menu to the window's menu-bar, which is obtained by calling
               getMenuBar().
getMenuBar

 public MenuBar getMenuBar()
  Returns      The menu-bar for this window.
  Overrides    Frame.getMenuBar()
  Description  If this window has a menu-bar, it is returned.  Otherwise a new menu-bar
               is created, added to the window and returned.
getMenuName

 public String getMenuName()
  Returns      The name to use for the Window menu.
  Description  This method is called when the first PolyWindow is constructed to obtain
               a string to use as the name for the Window menu.  The string 'Window' is
               returned.
setTitle

 public void setTitle(String title)
  Parameters   title          The new title to use for this window.
  Overrides    Frame.setTitle(String)
  Description  This method intercepts the method in java.awt.Frame to update the Window
               menu label for this window to reflect the new window title.
windowActivated

 public void windowActivated(WindowEvent e)
  Parameters   e              The event that has occurred.
  Overrides    DefaultWindow.windowActivated(WindowEvent)
  Description  Intercepts the window-activated event to update the Window menu.
windowClosed

 public void windowClosed(WindowEvent e)
  Parameters   e              The event that has occurred.
  Overrides    PolyWindow.windowClosed(WindowEvent)
  Description  Intercepts the window-closed event to update the Window menu.
windowDeactivated

 public void windowDeactivated(WindowEvent e)
  Parameters   e              The event that has occurred.
  Overrides    DefaultWindow.windowDeactivated(WindowEvent)
  Description  Intercepts the window-deactivated event to update the Window menu.

PolyWindow

Synopsis

Class Name:                   library.PolyWindow
Superclass:                   library.DefaultWindow
Immediate Subclasses:         library.PolyMenuWindow
Interfaces Implemented:       None

Description

An extension of DefaultWindow that terminates the Java system when the last window of a multi-window program is closed. An internal list is kept of all active PolyWindow objects.

Class Summary

public class library.PolyWindow extends library.DefaultWindow {
     // Constructor
     public PolyWindow(String title);

     // Class Methods
     public static Enumeration elements();
     public static PolyWindow getWindow(String name);
     public static int getWindowCount();

     // Instance Method
     public void windowClosed(WindowEvent e);
}

Constructor

PolyWindow

 public PolyWindow(String title)
  Parameters   title          The title to use for this window.
  Description  Constructs a hidden PolyWindow with the specified title and adds it to the
               internal list.

Class Methods

elements

 public static Enumeration elements()
  Returns      An Enumeration of the windows in the PolyWindow list.
  Description  This method returns an implementation of an Enumeration object which can
               be used to step through the currently active windows in the PolyWindow list.
getWindow

 public static PolyWindow getWindow(String name)
  Parameters   name           The name of an active PolyWindow.
  Returns      A reference to the PolyWindow with the specified name.
  Description  This method obtains a reference to a PolyWindow which has a specified name.
getWindowCount

 public static int getWindowCount()
  Returns      The number of active windows in the PolyWindow list.
  Description  Obtains the number of PolyWindow objects in the internal window list.

Instance Method

windowClosed

 public void windowClosed(WindowEvent e)
  Parameters   e              The event that has occurred.
  Overrides    DefaultWindow.windowClosed(WindowEvent)
  Description  This method is called when the window is closed.  It updates the internal
               window list and then, if this was the last PolyWindow in the list, it calls
               the overridden method in the superclass to terminate the Java system.

Go To:
IM250: Industrial Project