Method Summary |
void |
add(Component comp,
double x,
double y)
Adds the component to the canvas and sets its location
to the point (x , y ). |
void |
add(Component comp,
GPoint pt)
Adds the component to the canvas and sets its location to the specified point. |
void |
add(GObject gobj)
Adds a new graphical object to this container. |
void |
add(GObject gobj,
double x,
double y)
Adds the graphical object to the canvas and sets its location
to the point (x , y ). |
void |
add(GObject gobj,
GPoint pt)
Adds the graphical object to the canvas and sets its location to the specified point. |
void |
addKeyListeners()
Adds the program as a KeyListener to the canvas. |
void |
addKeyListeners(KeyListener listener)
Adds the specified listener as a KeyListener to the canvas. |
void |
addMouseListeners()
Adds the program as both a MouseListener and MouseMotionListener
to the canvas. |
void |
addMouseListeners(EventListener listener)
Adds the specified listener as a MouseListener and/or
MouseMotionListener , as appropriate, to the canvas. |
GObject |
getElement(int index)
Returns the graphical object at the specified index, numbering from back
to front in the the z dimension. |
GObject |
getElementAt(double x,
double y)
Returns the topmost graphical object that contains the point
(x , y ), or null if no such
object exists. |
GObject |
getElementAt(GPoint pt)
Returns the topmost graphical object that contains the specified point,
or null if no such object exists. |
int |
getElementCount()
Returns the number of graphical objects stored in this GCanvas . |
GCanvas |
getGCanvas()
Returns the GCanvas object used by this program. |
void |
init()
Specifies the code to be executed as startup time before the
run method is called. |
Iterator<GObject> |
iterator()
Returns an Iterator that cycles through the elements within
this container in the default direction, which is from back to front. |
Iterator<GObject> |
iterator(int direction)
Returns an Iterator that cycles through the elements
within this container in the specified direction, which must be one
of the constants FRONT_TO_BACK
or BACK_TO_FRONT
from the GContainer interface. |
void |
remove(GObject gobj)
Removes a graphical object from this container. |
void |
removeAll()
Removes all graphical objects from this container. |
void |
run()
Specifies the code to be executed as the program runs. |
void |
waitForClick()
Waits for a mouse click in the window before proceeding. |
Inherited Method Summary |
IOConsole | getConsole()
Returns the console associated with this program.
|
IODialog | getDialog()
Returns the dialog used for user interaction.
|
BufferedReader | getReader()
Returns a BufferedReader whose input comes from the console.
|
String | getTitle()
Gets the title of this program.
|
PrintWriter | getWriter()
Returns a PrintWriter whose output is directed to the console.
|
void | pause(double milliseconds)
Delays the calling thread for the specified time, which is expressed in
milliseconds.
|
void | print(String value)
Displays the argument value on the console, leaving the cursor at the end of
the output.
|
void | println()
Advances the console cursor to the beginning of the next line.
|
void | println(String value)
Displays the argument value on the console and then advances the cursor
to the next line.
|
boolean | readBoolean()
Reads and returns a boolean value (true or false ).
|
boolean | readBoolean(String prompt)
Prompts the user to enter a boolean value.
|
boolean | readBoolean(String prompt, String trueLabel, String falseLabel)
Prompts the user to enter a boolean value, which is matched against the
labels provided.
|
double | readDouble()
Reads and returns a double-precision value from the user.
|
double | readDouble(String prompt)
Prompts the user to enter a double-precision number, which is
returned as the value of this method.
|
int | readInt()
Reads and returns an integer value from the user.
|
int | readInt(String prompt)
Prompts the user to enter an integer.
|
String | readLine()
Reads and returns a line of input from the console.
|
String | readLine(String prompt)
Prompts the user for a line of input.
|
void | setTitle(String title)
Sets the title of this program.
|