public class BasicForm
extends java.lang.Object
BasicForm provides an easy way of giving Java applications a graphical user interface.
BasicForm creates a form that may have components added to it: labels, textfields, textareas, checkboxes, sliders, radio buttons, pictures, audio and buttons. These components can be read from and written to, making the BasicForm a source of data input for a program, and a means of the program to display output data.
Adding Components to a BasicForm
For each type of component (with the exception of buttons) there is an addXXXXXX method. (eg. addTextField())
that adds a component of that type to the BasicForm. With each of the add methods there is an optional String parameter for the
component's name which is used to access the component for reading, writing, getting attributes etc. If a name is not specified
then attributes of the component cannot be accessed, but the component may still be accessed for reading and writing as described in
Reading and Writing, below. A BasicForm expands to include all the fields added to it.
Along with the optional name parameter, some components have additional parameters. The list below are the most common
ones amongst the components. For specific parameters see the method summaries below.
label - a string to label the component on the BasicForm. The label auto sizes to the size of the text passed.
If a label is not specified when the component is created, it cannot be added later on. Similarly the size of the label
remains constant from its creation. If a longer string is passed as new text for the label, the text will be truncated, or
if a shorter string is passed, it will be padded the right. For this reason it is a good idea to provide
a label of ample size when adding components. To make things line up nicely you should provide Strings of equal length for all of
your labels.
width and height - the width and height of a component in pixels. TextFields and TextAreas do not have width and height parameters.
The height of a TextField is static and cannot be set and it's width may be changed by specifying a size. The size specifies how many characters
will be able to fit into the textbox. TextAreas have nRows and nCols, the number of rows and columns the TextArea can display.
x and y - the top left hand corner of the component. If the component has a label, the x and y will be the top left
hand corner of the label. In Java the top left hand corner of the window is (0,0) and both x and y increase as you move to the right and down.
Default Parameters
If a parameter is omitted, default values are used as follows:
name - no name, component cannot be accessed in methods by providing a name
label - no label
width and height - each component has its own set of defaults for its size
x and y - the component will be placed directly below the lowest component on the form along the left side of the
form with small gaps between it and the component above it and between it and the edge of the window.
Reading and Writing
Reads and writes can be performed on most components. There are 2 ways of specifying which component is read/written from/to.
1. Specifying the component name:
By specifying the name of a component in the read and write methods, you can read/write from/to any component on the BasicForm at any time.
2. Not providing a name of the component:
There is an invisible cursor that cycles through all of the components on the BasicForm. Every time a read or write is
performed the cursor moves to the component following the component read/written. When the last component is accessed, the cursor will cycle back
to the first component. The order in which the cursor cycles through the components is based on order in which the components
are added to the form. If you do not provide the read and write methods with a component name, the read/write is performed on the
component indicated by the cursor.
- If all reads/writes are done without supplying a name, the components are read/written from/to in the order in which they
were added to the form.
- If a name is used to perform a read/write operation, followed by a read/write operation without providing a name, the second read/write
will be perfromed from/to component following the one read/written from/to with the name.
Formats
Format objects can be provided with read and write methods. A Format object may be used to change the visual look of the output, for instance
if you write an int of value 1000 while providing a Format object to make it look like a currency the output may be "$1,000.00". If you were to
try use readInt without a format the operation would fail as it would be unable to interpret "$1,000.00" as an int. Providing the same Format object with the readInt method
here would allow readInt to return the value 1000.
A TextField can have a default formats which will automatically be used to format any data read/written from/to it. If a
read or write operation is performed on a textfield that has a default format, then the format object passed in the read/write
method temporarily overrides the default format.
The 3 States of a BasicForm
A BasicForm has 3 states:
Invisible - the form is not visible on the screen. The program creating the form is running and can
interact with the form. This is the initial state of a form and may be achieved at any time via the hide() method.
Visible - the form is visible on the screen. The program creating the form is running and can interact
with the form. The buttons on the form are not visible indicating to the user that s/he cannot interact with the form. This
state automatically occurs after the user presses a button when the form is in the User has Control state and may be
achieved at any time via the show() method.
User has Control - the form is visible on the screen and the program creating the form is suspended
awaiting user input. The buttons are visible and the user may interact with the form. When the user presses a button, the
form goes to the Visible state, allowing the program to interact with the form and/or make the form invisible.
This state may be achieved via the accept() method.
Buttons
Whenever the form in in User has Control state, one or more buttons are displayed to allow the user to select one or more
actions when dismissing the form. A default set of buttons for the form can be specified supplying a set of button names
(String) in the BasicForm constructor. If no default button names are provided, the default will be one button named OK.
Buttons are shown whenever the accept() method is called. If the accept method has no parameters, the default buttons are
displayed. A different set of buttons can be displayed by providing a set of button names (String) as parameters to the accept
method. These temporarily override the default buttons.
The buttons on the form are used by the user to dismiss the form, returning it to the Visible state, and giving control
back to the program. The accept() method returns an int whose value is based on the button pressed. If the first button was
pressed a 0 will be returned, the 2nd button will return a 1. The nth button will return n-1. The buttons are numbered based
on the order they were passed to the BasicForm constructor or accept method.
Exceptions
Exceptions can be thrown when 'problems' occur. If an exception occurs and is not caught the program will crash. There are 4
kinds of Exceptions that may occur.
ComponentNotFoundException - is thrown if a read or write operation cannot find a component with the specified name on the form.
IllegalOperationException - is thrown if an operation is performed on an incompatible component, e.g. trying to place a picture onto a textfield.
NameAlreadyExistsException - is thrown if a component is added with a name identical to an existing component on the form.
NoComponentOnFormException - is thrown if an operation is attempted to be performed on a component which does not exist on the form.
Sample Code demonstrating writing and reading from a component.
String field2output;
BasicForm form = new BasicForm();
form.addTextField("field1");
form.addTextField("field2");
form.writeString("field1", "this is field 1");
form.accept();
field2output = form.readString("field2");
Constructor and Description |
---|
BasicForm()
Creates a form with one default button labeled OK.
|
BasicForm(java.lang.String... buttons)
Creates a form with the specified deafult buttons.
|
Modifier and Type | Method and Description |
---|---|
int |
accept()
The form is made visible with the default buttons and the program is suspended, putting the form into User has
Control state.
|
int |
accept(java.lang.String... buttons)
The form is made visible with the specified buttons and the program is suspended, putting the form into User has
Control state.
|
void |
addCanvas() |
void |
addCanvas(int width,
int height) |
void |
addCanvas(int width,
int height,
int x,
int y) |
void |
addCanvas(java.lang.String name) |
void |
addCanvas(java.lang.String name,
int width,
int height) |
void |
addCanvas(java.lang.String name,
int width,
int height,
int x,
int y) |
void |
addCanvas(java.lang.String name,
java.lang.String label) |
void |
addCanvas(java.lang.String name,
java.lang.String label,
int width,
int height) |
void |
addCanvas(java.lang.String name,
java.lang.String label,
int width,
int height,
int x,
int y)
Adds a canvas with specified name, label, size, and x,y co-ordinates to the form.
|
void |
addCheckBox() |
void |
addCheckBox(int x,
int y) |
void |
addCheckBox(java.lang.String name) |
void |
addCheckBox(java.lang.String name,
int x,
int y) |
void |
addCheckBox(java.lang.String name,
java.lang.String label) |
void |
addCheckBox(java.lang.String name,
java.lang.String label,
int x,
int y)
Adds a checkbox with the specified name, label and x,y co-ordinate to the form.
|
void |
addCustomComponent(javax.swing.JComponent c)
Adds any JComponent to the form.
|
void |
addLabel() |
void |
addLabel(int x,
int y) |
void |
addLabel(java.lang.String name) |
void |
addLabel(java.lang.String name,
int x,
int y) |
void |
addLabel(java.lang.String name,
java.lang.String label) |
void |
addLabel(java.lang.String name,
java.lang.String label,
int x,
int y)
Adds a label with the specified name, text and x,y co-ordinate to the form.
|
void |
addRadioButtons(boolean vertical,
int x,
int y,
java.lang.String... buttons) |
void |
addRadioButtons(boolean vertical,
java.lang.String... buttons) |
void |
addRadioButtons(java.lang.String... buttons) |
void |
addRadioButtons(java.lang.String name,
boolean vertical,
int x,
int y,
java.lang.String... buttons) |
void |
addRadioButtons(java.lang.String name,
boolean vertical,
java.lang.String... buttons) |
void |
addRadioButtons(java.lang.String name,
java.lang.String label,
boolean vertical,
int x,
int y,
java.lang.String... buttons)
Adds a group of radio buttons with the specified name, label orientation and x,y co-ordinate to the form.
|
void |
addRadioButtons(java.lang.String name,
java.lang.String label,
boolean vertical,
java.lang.String... buttons) |
void |
addSlider() |
void |
addSlider(int min,
int max) |
void |
addSlider(int min,
int max,
int size) |
void |
addSlider(int min,
int max,
int size,
int x,
int y) |
void |
addSlider(java.lang.String name) |
void |
addSlider(java.lang.String name,
int min,
int max) |
void |
addSlider(java.lang.String name,
int min,
int max,
int size) |
void |
addSlider(java.lang.String name,
int min,
int max,
int size,
int x,
int y) |
void |
addSlider(java.lang.String name,
java.lang.String label) |
void |
addSlider(java.lang.String name,
java.lang.String label,
int min,
int max) |
void |
addSlider(java.lang.String name,
java.lang.String label,
int min,
int max,
int size) |
void |
addSlider(java.lang.String name,
java.lang.String label,
int min,
int max,
int size,
int x,
int y)
Adds a slider with the specified name, label, range, size and x,y co-ordinate to the form.
|
void |
addSound() |
void |
addSound(int x,
int y) |
void |
addSound(Sound s) |
void |
addSound(Sound s,
int x,
int y) |
void |
addSound(java.lang.String name) |
void |
addSound(java.lang.String name,
int x,
int y) |
void |
addSound(java.lang.String name,
Sound s) |
void |
addSound(java.lang.String name,
java.lang.String label) |
void |
addSound(java.lang.String name,
java.lang.String label,
int x,
int y) |
void |
addSound(java.lang.String name,
java.lang.String label,
Sound s) |
void |
addSound(java.lang.String name,
java.lang.String label,
Sound s,
int x,
int y)
Adds a sound player (a button that when pressed will play the sound associated with the player) with specified name, label,
sound and x,y co-ordinate to the form.
|
void |
addTextArea() |
void |
addTextArea(int nRow,
int nCol) |
void |
addTextArea(int nRow,
int nCol,
int x,
int y) |
void |
addTextArea(java.lang.String name) |
void |
addTextArea(java.lang.String name,
int nRow,
int nCol) |
void |
addTextArea(java.lang.String name,
int nRow,
int nCol,
int x,
int y) |
void |
addTextArea(java.lang.String name,
java.lang.String label) |
void |
addTextArea(java.lang.String name,
java.lang.String label,
int nRow,
int nCol) |
void |
addTextArea(java.lang.String name,
java.lang.String label,
int nRow,
int nCol,
int x,
int y)
Adds a text area, with the specified name, label, number of columns,
number of rows and x,y co-ordinate to the form.
|
void |
addTextField() |
void |
addTextField(java.text.Format f) |
void |
addTextField(java.text.Format f,
int size) |
void |
addTextField(java.text.Format f,
int size,
int x,
int y) |
void |
addTextField(int size) |
void |
addTextField(int size,
int x,
int y) |
void |
addTextField(java.lang.String name) |
void |
addTextField(java.lang.String name,
java.text.Format f) |
void |
addTextField(java.lang.String name,
java.text.Format f,
int size) |
void |
addTextField(java.lang.String name,
java.text.Format f,
int size,
int x,
int y) |
void |
addTextField(java.lang.String name,
int size) |
void |
addTextField(java.lang.String name,
int size,
int x,
int y) |
void |
addTextField(java.lang.String name,
java.lang.String label) |
void |
addTextField(java.lang.String name,
java.lang.String label,
java.text.Format f) |
void |
addTextField(java.lang.String name,
java.lang.String label,
java.text.Format f,
int size) |
void |
addTextField(java.lang.String name,
java.lang.String label,
java.text.Format f,
int size,
int x,
int y)
Adds a text field with the specified name, label, default format,
size and x,y co-ordinate to the form.
|
void |
addTextField(java.lang.String name,
java.lang.String label,
int size) |
void |
addTextField(java.lang.String name,
java.lang.String label,
int size,
int x,
int y) |
void |
clear() |
void |
clear(java.lang.String name)
Clears the value displayed in the specified component on the form.
|
void |
clearAll()
Clears the values displayed in all components of the form.
|
void |
close()
Closes the form and frees resources.
|
int |
getHeight(java.lang.String name)
Returns the height in pixels of component on the form
|
Picture |
getPicture(java.lang.String name)
Gets a picture from a canvas.
|
Sound |
getSound(java.lang.String name)
Gets a sound from a sound player.
|
Turtle |
getTurtle(java.lang.String name)
Gets a turtle from a canvas.
|
int |
getWidth(java.lang.String name)
Returns the width in pixels of component on the form
|
int |
getX(java.lang.String name)
Returns the x co-ordinate of the top left corner of a component on the form
|
int |
getY(java.lang.String name)
Returns the y co-ordinate of the top left corner of a component on the form
|
void |
hide()
Makes the form invisible on the screen, putting the form into the Invisible state.
|
boolean |
isDataError()
Returns true if last operation failed due to being unable to convert the data to the specified type.
|
boolean |
isEditable(java.lang.String name)
Returns true if the component is set to editable, false otherwise.
|
boolean |
isEOF()
Returns true if last operation failed due to reading when at EOF.
|
boolean |
isFormatException()
Returns true if last operation failed due to being unable to format data.
|
void |
newLine() |
void |
newLine(java.lang.String name)
Writes a newline character to the specified component on the form.
|
void |
nextLine() |
void |
nextLine(java.lang.String name)
The next read from the specified component on the form will start at the first character of the next line.
|
void |
placePicture(java.lang.String name,
Picture p)
Places a picture onto a canvas.
|
void |
placeSound(java.lang.String name,
Sound s)
Places a sound into a sound player on the form
|
void |
placeTurtle(java.lang.String name,
Turtle t)
Places a turtle onto a canvas.
|
boolean |
readBoolean() |
boolean |
readBoolean(java.lang.String name)
Reads a boolean from the specified component on the form.
|
byte |
readByte() |
byte |
readByte(java.text.Format f) |
byte |
readByte(java.lang.String name) |
byte |
readByte(java.lang.String name,
java.text.Format f)
Reads a byte from the specified component on the form.
|
char |
readC() |
char |
readC(java.lang.String name)
Reads a char from the specified component on the form.
|
char |
readChar() |
char |
readChar(java.lang.String name)
Reads a char from the specified component on the form.
|
double |
readDouble() |
double |
readDouble(java.text.Format f) |
double |
readDouble(java.lang.String name) |
double |
readDouble(java.lang.String name,
java.text.Format f)
Reads a double from the specified component on the form.
|
float |
readFloat() |
float |
readFloat(java.text.Format f) |
float |
readFloat(java.lang.String name) |
float |
readFloat(java.lang.String name,
java.text.Format f)
Reads a float from the specified component on the form.
|
int |
readInt() |
int |
readInt(java.text.Format f) |
int |
readInt(java.lang.String name) |
int |
readInt(java.lang.String name,
java.text.Format f)
Reads an int from the specified component on the form.
|
java.lang.String |
readLine() |
java.lang.String |
readLine(java.lang.String name)
Reads a line of text as a String from the specified component on the form.
|
long |
readLong() |
long |
readLong(java.text.Format f) |
long |
readLong(java.lang.String name) |
long |
readLong(java.lang.String name,
java.text.Format f)
Reads a long from the specified component on the form.
|
short |
readShort() |
short |
readShort(java.text.Format f) |
short |
readShort(java.lang.String name) |
short |
readShort(java.lang.String name,
java.text.Format f)
Reads a short from the specified component on the form.
|
java.lang.String |
readString() |
java.lang.String |
readString(java.lang.String name)
Reads a String from the specified component on the form.
|
void |
setEditable(java.lang.String name,
boolean editable)
Sets the edit state of the component.
|
void |
setLabel(java.lang.String name,
java.lang.String label)
Changes the text of a label of a component.
|
void |
setSound(java.lang.String name,
Sound s)
Deprecated.
use placeSound instead
|
void |
setTitle(java.lang.String title)
Sets the title in the title bar of the form to the String passed.
|
void |
setTurtle(java.lang.String name,
Turtle t)
Deprecated.
use placeTurtle instead
|
void |
show()
Makes the form visible on the screen, putting the form into the Visible state.
|
void |
skipToEOL()
Deprecated.
Use nextLine() instead.
|
void |
skipToEOL(java.lang.String name)
Deprecated.
use nextLine(name) instead.
|
boolean |
successful()
Returns true if the last operation (eg readxxx, writexxx) was succesful, false otherwise.
|
void |
writeBoolean(boolean b) |
void |
writeBoolean(java.lang.String name,
boolean b)
Writes a boolean value to the specified component on the form.
|
void |
writeByte(byte b) |
void |
writeByte(byte b,
java.text.Format f) |
void |
writeByte(byte b,
java.text.Format f,
int size) |
void |
writeByte(byte b,
int size) |
void |
writeByte(java.lang.String name,
byte b) |
void |
writeByte(java.lang.String name,
byte b,
java.text.Format f) |
void |
writeByte(java.lang.String name,
byte b,
java.text.Format f,
int size)
Writes a byte value to the specified component on the form.
|
void |
writeByte(java.lang.String name,
byte b,
int size) |
void |
writeC(char c) |
void |
writeC(java.lang.String name,
char c)
Writes a char value to the specified component on the form.
|
void |
writeChar(char c) |
void |
writeChar(java.lang.String name,
char c)
Writes a char value to the specified component on the form.
|
void |
writeDouble(double d) |
void |
writeDouble(double d,
java.text.Format f) |
void |
writeDouble(double d,
java.text.Format f,
int size) |
void |
writeDouble(double d,
int size) |
void |
writeDouble(java.lang.String name,
double d) |
void |
writeDouble(java.lang.String name,
double d,
java.text.Format f) |
void |
writeDouble(java.lang.String name,
double d,
java.text.Format f,
int size)
Writes a double value to the specified component on the form.
|
void |
writeDouble(java.lang.String name,
double d,
int size) |
void |
writeEOL()
Deprecated.
use newLine() instead
|
void |
writeEOL(java.lang.String name)
Deprecated.
Use newLine() instead.
|
void |
writeFloat(float f) |
void |
writeFloat(float f,
java.text.Format format) |
void |
writeFloat(float f,
java.text.Format fmt,
int size) |
void |
writeFloat(float f,
int size) |
void |
writeFloat(java.lang.String name,
float f) |
void |
writeFloat(java.lang.String name,
float f,
java.text.Format format) |
void |
writeFloat(java.lang.String name,
float f,
java.text.Format fmt,
int size)
Writes a float value to the specified component on the form.
|
void |
writeFloat(java.lang.String name,
float f,
int size) |
void |
writeInt(int i) |
void |
writeInt(int i,
java.text.Format f) |
void |
writeInt(int i,
java.text.Format f,
int size) |
void |
writeInt(int i,
int size) |
void |
writeInt(java.lang.String name,
int i) |
void |
writeInt(java.lang.String name,
int i,
java.text.Format f) |
void |
writeInt(java.lang.String name,
int i,
java.text.Format f,
int size)
Writes an int value to the specified component on the form.
|
void |
writeInt(java.lang.String name,
int i,
int size) |
void |
writeLine(java.lang.String s) |
void |
writeLine(java.lang.String name,
java.lang.String s)
Writes a string as a line to the specified component on the form.
|
void |
writeLong(long l) |
void |
writeLong(long l,
java.text.Format f) |
void |
writeLong(long l,
java.text.Format f,
int size) |
void |
writeLong(long l,
int size) |
void |
writeLong(java.lang.String name,
long l) |
void |
writeLong(java.lang.String name,
long l,
java.text.Format f) |
void |
writeLong(java.lang.String name,
long l,
java.text.Format f,
int size)
Writes a long value to the specified component on the form.
|
void |
writeLong(java.lang.String name,
long l,
int size) |
void |
writeShort(short s) |
void |
writeShort(short s,
java.text.Format f) |
void |
writeShort(short s,
java.text.Format f,
int size) |
void |
writeShort(short s,
int size) |
void |
writeShort(java.lang.String name,
short s) |
void |
writeShort(java.lang.String name,
short s,
java.text.Format f) |
void |
writeShort(java.lang.String name,
short s,
java.text.Format f,
int size)
Writes a short value to the specified component on the form.
|
void |
writeShort(java.lang.String name,
short s,
int size) |
void |
writeString(java.lang.String s) |
void |
writeString(java.lang.String s,
java.text.Format f) |
void |
writeString(java.lang.String s,
java.text.Format f,
int size) |
void |
writeString(java.lang.String s,
int size) |
void |
writeString(java.lang.String name,
java.lang.String s) |
void |
writeString(java.lang.String name,
java.lang.String s,
java.text.Format f) |
void |
writeString(java.lang.String name,
java.lang.String s,
java.text.Format f,
int size)
Writes a String value to the specified component on the form.
|
void |
writeString(java.lang.String name,
java.lang.String s,
int size) |
public BasicForm(java.lang.String... buttons)
buttons
- the Strings which represent the default buttons on the form.public BasicForm()
public boolean successful()
public boolean isEOF()
public boolean isFormatException()
public boolean isDataError()
public void setTitle(java.lang.String title)
title
- will become the title on the form.public int getX(java.lang.String name) throws ComponentNotFoundException
name
- the name of the component.ComponentNotFoundException
- none of the components on the BasicForm have the specified name.public int getY(java.lang.String name) throws ComponentNotFoundException
name
- the name of the component.ComponentNotFoundException
- none of the components on the BasicForm have the specified name.public int getWidth(java.lang.String name) throws ComponentNotFoundException
name
- the name of the component.ComponentNotFoundException
- none of the components on the BasicForm have the specified name.public int getHeight(java.lang.String name) throws ComponentNotFoundException
name
- the name of the component.ComponentNotFoundException
- none of the components on the BasicForm have the specified name.public void setLabel(java.lang.String name, java.lang.String label) throws ComponentNotFoundException
name
- the name of the componentlabel
- the text to put into the labelComponentNotFoundException
- none of the components on the BasicForm have the specified name.public void placePicture(java.lang.String name, Picture p) throws IllegalOperationException, ComponentNotFoundException
name
- the name of the canvas componentp
- a picture to be placed onto the canvasComponentNotFoundException
- none of the components on the BasicForm have the specified name.IllegalOperationException
- the component with the specified name is not a canvas.public void setSound(java.lang.String name, Sound s)
name
- the name of the sound player components
- the sound to be placed into the sound playerComponentNotFoundException
- none of the components on the BasicForm have the specified name.IllegalOperationException
- the component with the specified name is not a sound player.public void setTurtle(java.lang.String name, Turtle t) throws IllegalOperationException
name
- the name of the canvas componentt
- the turtle to be put onto the canvasComponentNotFoundException
- none of the components on the BasicForm have the specified name.IllegalOperationException
- the component with the specified name is not a canvas.public void placeSound(java.lang.String name, Sound s)
name
- the name of the sound player components
- the sound to be placed into the sound playerComponentNotFoundException
- none of the components on the BasicForm have the specified name.IllegalOperationException
- the component with the specified name is not a sound player.public void placeTurtle(java.lang.String name, Turtle t) throws IllegalOperationException
name
- the name of the canvas componentt
- the turtle to be put onto the canvasComponentNotFoundException
- none of the components on the BasicForm have the specified name.IllegalOperationException
- the component with the specified name is not a canvas.public Picture getPicture(java.lang.String name) throws IllegalOperationException
name
- the name of the canvas componentIllegalOperationException
- the component with the specified name is not a canvas.public Sound getSound(java.lang.String name) throws IllegalOperationException
name
- the name of the sound player componentIllegalOperationException
- the component with the specified name is not a sound player.public Turtle getTurtle(java.lang.String name) throws IllegalOperationException
name
- the name of the canvas componentIllegalOperationException
- the component with the specified name is not a canvas.public void show()
public void hide()
public int accept()
public int accept(java.lang.String... buttons)
buttons
- buttons that will be displayedpublic void setEditable(java.lang.String name, boolean editable)
name
- the name of the componenteditable
- the component is editableComponentNotFoundException
- none of the components on the BasicForm have the specified name.public boolean isEditable(java.lang.String name)
name
- the name of the componentComponentNotFoundException
- none of the components on the BasicForm have the specified name.public void addLabel(java.lang.String name, java.lang.String label, int x, int y) throws NameAlreadyExistsException
name
- the name of the label component.label
- the text the label displays.x
- The x co-ordinate of the top left corner of the label.y
- The y co-ordinate of the top left corner of the label.NameAlreadyExistsException
- the name has already been used for another component.public void addLabel()
public void addLabel(int x, int y)
public void addLabel(java.lang.String name)
public void addLabel(java.lang.String name, int x, int y)
public void addLabel(java.lang.String name, java.lang.String label)
public void addTextField(java.lang.String name, java.lang.String label, java.text.Format f, int size, int x, int y) throws NameAlreadyExistsException
name
- the name of the text field component.label
- the text to be displayed in the label.f
- the default format for the text field.size
- the size of the text field in characters.x
- the x co-ordinate of the top left corner of the label/text fieldy
- the y co-ordinate of the top left corner of the label/text fieldNameAlreadyExistsException
- the name has already been used for another component.public void addTextField(java.lang.String name, java.lang.String label, java.text.Format f, int size)
public void addTextField(java.lang.String name, java.lang.String label, java.text.Format f)
public void addTextField(java.lang.String name, java.lang.String label)
public void addTextField(java.lang.String name)
public void addTextField(java.lang.String name, java.text.Format f, int size, int x, int y)
public void addTextField(java.lang.String name, java.text.Format f, int size)
public void addTextField(java.lang.String name, java.text.Format f)
public void addTextField(java.lang.String name, java.lang.String label, int size, int x, int y)
public void addTextField(java.lang.String name, java.lang.String label, int size)
public void addTextField(java.lang.String name, int size, int x, int y)
public void addTextField(java.lang.String name, int size)
public void addTextField(java.text.Format f, int size, int x, int y)
public void addTextField(java.text.Format f, int size)
public void addTextField(java.text.Format f)
public void addTextField(int size, int x, int y)
public void addTextField(int size)
public void addTextField()
public void addTextArea(java.lang.String name, java.lang.String label, int nRow, int nCol, int x, int y)
name
- the name of the text area component.label
- the text to be displayed in the label.nCol
- the number of columns the text area will have (in lines)nRow
- the number of rows the text area will have (in characters)x
- The x co-ordinate of the top left corner of the label/text areay
- The y co-ordinate of the top left corner of the label/text areaNameAlreadyExistsException
- the name has already been used for another component.public void addTextArea(java.lang.String name, java.lang.String label, int nRow, int nCol)
public void addTextArea(java.lang.String name, java.lang.String label)
public void addTextArea(java.lang.String name)
public void addTextArea(java.lang.String name, int nRow, int nCol, int x, int y)
public void addTextArea(java.lang.String name, int nRow, int nCol)
public void addTextArea(int nRow, int nCol, int x, int y)
public void addTextArea(int nRow, int nCol)
public void addTextArea()
public void addCheckBox(java.lang.String name, java.lang.String label, int x, int y) throws NameAlreadyExistsException
name
- the name of the checkbox component.label
- the text to be displayed in the label.x
- the x co-ordinate of the top left corner of the checkboxy
- the y co-ordinate of the top left corner of the checkboxNameAlreadyExistsException
- the name has already been used for another component.public void addCheckBox(java.lang.String name, java.lang.String label)
public void addCheckBox(java.lang.String name)
public void addCheckBox(java.lang.String name, int x, int y)
public void addCheckBox(int x, int y)
public void addCheckBox()
public void addRadioButtons(java.lang.String name, java.lang.String label, boolean vertical, int x, int y, java.lang.String... buttons) throws NameAlreadyExistsException
name
- the name radio button group component.label
- the text to be displayed in the label.vertical
- the radio buttons will be laid out in a vertical fashion, false for a horizontal layoutx
- the x co-ordinate of the top left corner of the radio button groupy
- the y co-ordinate of the top left corner of the radio button groupbuttons
- the labels for the buttons in the radio button groupNameAlreadyExistsException
- the name has already been used for another component.public void addRadioButtons(java.lang.String name, java.lang.String label, boolean vertical, java.lang.String... buttons)
public void addRadioButtons(java.lang.String name, boolean vertical, int x, int y, java.lang.String... buttons)
public void addRadioButtons(java.lang.String name, boolean vertical, java.lang.String... buttons)
public void addRadioButtons(boolean vertical, int x, int y, java.lang.String... buttons)
public void addRadioButtons(boolean vertical, java.lang.String... buttons)
public void addRadioButtons(java.lang.String... buttons)
public void addSlider(java.lang.String name, java.lang.String label, int min, int max, int size, int x, int y) throws NameAlreadyExistsException
name
- the name of the slider component.label
- the text to be displayed in the label.min
- the minimum value of the slidermax
- the maximum value of the slidersize
- the physical size of the slider (in pixels)x
- The x co-ordinate of the top left corner of the slidery
- The y co-ordinate of teh top left corner of the sliderNameAlreadyExistsException
- the name has already been used for another component.public void addSlider(java.lang.String name, java.lang.String label, int min, int max, int size)
public void addSlider(java.lang.String name, java.lang.String label, int min, int max)
public void addSlider(java.lang.String name, java.lang.String label)
public void addSlider(java.lang.String name)
public void addSlider(java.lang.String name, int min, int max, int size, int x, int y)
public void addSlider(java.lang.String name, int min, int max, int size)
public void addSlider(java.lang.String name, int min, int max)
public void addSlider(int min, int max, int size, int x, int y)
public void addSlider(int min, int max, int size)
public void addSlider(int min, int max)
public void addSlider()
public void addSound(java.lang.String name, java.lang.String label, Sound s, int x, int y)
name
- the name of the sound player componentlabel
- the label for the sound players
- a sound file associated with the sound playerx
- the x co-ordinate of the top left corner of the sound playery
- the y co-ordinate of the top left corner of the sound playerNameAlreadyExistsException
- the name has already been used for another component.public void addSound()
public void addSound(Sound s)
public void addSound(java.lang.String name)
public void addSound(java.lang.String name, Sound s)
public void addSound(int x, int y)
public void addSound(Sound s, int x, int y)
public void addSound(java.lang.String name, int x, int y)
public void addSound(java.lang.String name, java.lang.String label)
public void addSound(java.lang.String name, java.lang.String label, Sound s)
public void addSound(java.lang.String name, java.lang.String label, int x, int y)
public void addCanvas(java.lang.String name, java.lang.String label, int width, int height, int x, int y) throws NameAlreadyExistsException
name
- the name of the canvaslabel
- a label to be associated with the canvaswidth
- the width of the canvasheight
- the height of the canvasx
- the x co-ordinate of the top left corner of the canvasy
- the y co-ordinate of the top left corner of the canvasNameAlreadyExistsException
- the name has already been used for another component.public void addCanvas(java.lang.String name, java.lang.String label, int width, int height)
public void addCanvas(java.lang.String name, java.lang.String label)
public void addCanvas(java.lang.String name)
public void addCanvas(java.lang.String name, int width, int height, int x, int y)
public void addCanvas(java.lang.String name, int width, int height)
public void addCanvas(int width, int height, int x, int y)
public void addCanvas(int width, int height)
public void addCanvas()
public void skipToEOL()
nextLine(String)
public void nextLine()
nextLine(String)
public void skipToEOL(java.lang.String name)
name
- name of the componentpublic void nextLine(java.lang.String name)
name
- name of the componentpublic boolean readBoolean()
readBoolean(String)
public boolean readBoolean(java.lang.String name)
name
- the name of componentpublic byte readByte()
readByte(String,Format)
public byte readByte(java.lang.String name)
readByte(String,Format)
public byte readByte(java.text.Format f)
readByte(String,Format)
public byte readByte(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic char readC()
readC(String)
public char readC(java.lang.String name)
name
- the name of componentpublic char readChar()
readChar(String)
public char readChar(java.lang.String name)
name
- the name of componentpublic double readDouble()
readDouble(String,Format)
public double readDouble(java.lang.String name)
readDouble(String,Format)
public double readDouble(java.text.Format f)
readDouble(String,Format)
public double readDouble(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic float readFloat()
readFloat(String,Format)
public float readFloat(java.lang.String name)
readFloat(String,Format)
public float readFloat(java.text.Format f)
readFloat(String,Format)
public float readFloat(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic int readInt()
readInt(String,Format)
public int readInt(java.lang.String name)
readInt(String,Format)
public int readInt(java.text.Format f)
readInt(String,Format)
public int readInt(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic java.lang.String readLine()
readLine(String)
public java.lang.String readLine(java.lang.String name)
name
- the name of componentpublic long readLong()
readLong(String,Format)
public long readLong(java.lang.String name)
readLong(String,Format)
public long readLong(java.text.Format f)
readLong(String,Format)
public long readLong(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic short readShort()
readShort(String,Format)
public short readShort(java.lang.String name)
readShort(String,Format)
public short readShort(java.text.Format f)
readShort(String,Format)
public short readShort(java.lang.String name, java.text.Format f)
name
- the name of componentf
- the format for readingpublic java.lang.String readString()
readString(String)
public java.lang.String readString(java.lang.String name)
name
- the name of componentpublic void writeEOL()
writeEOL(String)
public void writeEOL(java.lang.String name)
name
- the name of the componentpublic void newLine(java.lang.String name)
name
- the name of the componentpublic void newLine()
newLine(String)
public void writeBoolean(boolean b)
public void writeBoolean(java.lang.String name, boolean b)
name
- the field to write tob
- the boolean value to writepublic void writeByte(byte b)
writeByte(String,byte,Format,int)
public void writeByte(java.lang.String name, byte b)
writeByte(String,byte,Format,int)
public void writeByte(byte b, java.text.Format f)
writeByte(String,byte,Format,int)
public void writeByte(java.lang.String name, byte b, java.text.Format f)
writeByte(String,byte,Format,int)
public void writeByte(java.lang.String name, byte b, java.text.Format f, int size)
name
- the name of the componentb
- the byte value to writef
- the format for the writesize
- display size in characterspublic void writeByte(java.lang.String name, byte b, int size)
writeByte(String,byte,Format,int)
public void writeByte(byte b, java.text.Format f, int size)
writeByte(String,byte,Format,int)
public void writeByte(byte b, int size)
writeByte(String,byte,Format,int)
public void writeC(char c)
writeC(String name,char c)
public void writeC(java.lang.String name, char c)
name
- the field to write toc
- the char value to writepublic void writeChar(char c)
writeChar(String name,char c)
public void writeChar(java.lang.String name, char c)
name
- the field to write toc
- the char value to writepublic void writeDouble(double d)
public void writeDouble(java.lang.String name, double d)
public void writeDouble(double d, java.text.Format f)
public void writeDouble(java.lang.String name, double d, java.text.Format f)
public void writeDouble(java.lang.String name, double d, java.text.Format f, int size)
name
- the name of the componentd
- the double value to writef
- the format for the writesize
- display size in characterspublic void writeDouble(java.lang.String name, double d, int size)
public void writeDouble(double d, java.text.Format f, int size)
public void writeDouble(double d, int size)
public void writeFloat(float f)
public void writeFloat(float f, java.text.Format format)
public void writeFloat(java.lang.String name, float f)
public void writeFloat(java.lang.String name, float f, java.text.Format format)
public void writeFloat(java.lang.String name, float f, java.text.Format fmt, int size)
name
- the name of the componentf
- the float value to writefmt
- the format for the writesize
- display size in characterspublic void writeFloat(java.lang.String name, float f, int size)
public void writeFloat(float f, java.text.Format fmt, int size)
public void writeFloat(float f, int size)
public void writeInt(int i)
public void writeInt(int i, java.text.Format f)
public void writeInt(java.lang.String name, int i)
public void writeInt(java.lang.String name, int i, java.text.Format f)
public void writeInt(java.lang.String name, int i, java.text.Format f, int size)
name
- the name of the componenti
- the int value to writef
- the format for the writesize
- display size in characterspublic void writeInt(java.lang.String name, int i, int size)
public void writeInt(int i, java.text.Format f, int size)
public void writeInt(int i, int size)
public void writeLine(java.lang.String s)
writeLine(String name, String s)
public void writeLine(java.lang.String name, java.lang.String s)
name
- the name of the components
- the String value to writepublic void writeLong(long l)
public void writeLong(long l, java.text.Format f)
public void writeLong(java.lang.String name, long l)
public void writeLong(java.lang.String name, long l, java.text.Format f)
public void writeLong(java.lang.String name, long l, java.text.Format f, int size)
name
- the name of the componentl
- the long value to writef
- the format for the writesize
- display size in characterspublic void writeLong(java.lang.String name, long l, int size)
public void writeLong(long l, java.text.Format f, int size)
public void writeLong(long l, int size)
public void writeShort(short s)
public void writeShort(short s, java.text.Format f)
public void writeShort(java.lang.String name, short s)
public void writeShort(java.lang.String name, short s, java.text.Format f)
public void writeShort(java.lang.String name, short s, java.text.Format f, int size)
name
- the name of the components
- the short value to writef
- the format for the writesize
- display size in characterspublic void writeShort(java.lang.String name, short s, int size)
public void writeShort(short s, java.text.Format f, int size)
public void writeShort(short s, int size)
public void writeString(java.lang.String s)
public void writeString(java.lang.String s, java.text.Format f)
public void writeString(java.lang.String name, java.lang.String s)
public void writeString(java.lang.String name, java.lang.String s, java.text.Format f)
public void writeString(java.lang.String s, int size)
public void writeString(java.lang.String s, java.text.Format f, int size)
public void writeString(java.lang.String name, java.lang.String s, int size)
public void writeString(java.lang.String name, java.lang.String s, java.text.Format f, int size)
name
- the field to write tos
- the String value to writef
- the format for the writesize
- the size of the field to writepublic void clear()
clear(String name)
public void clear(java.lang.String name)
name
- the name of the componentpublic void clearAll()
public void close()
public void addCustomComponent(javax.swing.JComponent c)