|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Frame
|
+--javax.swing.JFrame
|
+--acm.graphics.GFrame
public class GFrame extends JFrameThe GFrame class is a top-level Swing window that contains a GCanvas that fills the area of the frame.
| Field Summary | |
| static int | BACK_TO_FRONT
|
| static int | FRONT_TO_BACK
|
| Constructor Summary |
| GFrame()
|
| GFrame(String title)
|
| Method Summary | |
| void | add(GObject gobj)
|
| void | add(GObject gobj,
double x,
double y)
|
| void | add(GObject gobj,
java.awt.Point pt)
|
| GCanvas | createGCanvas()
|
| MenuBar | createMenuBar()
|
| GObject | getElement(int index)
|
| GObject | getElementAt(double x,
double y)
|
| int | getElementCount()
|
| GCanvas | getGCanvas()
|
| boolean | isAutoRepaintEnabled()
|
| Iterator | iterator()
|
| Iterator | iterator(int direction)
|
| void | onMouseClicked(double x,
double y)
|
| void | onMouseDragged(double x,
double y)
|
| void | onMouseMoved(double x,
double y)
|
| void | onMousePressed(double x,
double y)
|
| void | onMouseReleased(double x,
double y)
|
| void | remove(GObject gobj)
|
| void | removeAll()
|
| void | removeAllComponents()
|
| void | setAutoRepaintEnabled(boolean state)
|
| Field Detail |
public static final int BACK_TO_FRONT
public static final int FRONT_TO_BACK| Constructor Detail |
public GFrame()| Usage: | GFrame frame = new GFrame(); |
public GFrame(String title)| Usage: | GFrame frame = new GFrame(title); |
| Method Detail |
public void add(GObject gobj)| Usage: | frame.add(gobj); | ||
| Parameter: |
|
public void add(GObject gobj,
double x,
double y)| Usage: | frame.add(gobj, x, y); | ||||||
| Parameters: |
|
public final void add(GObject gobj,
Point pt)| Usage: | frame.add(gobj, pt); | ||||
| Parameters: |
|
public GCanvas createGCanvas()
public MenuBar createMenuBar()| Usage: | MenuBar mbar = frame.createMenuBar(); |
| Returns: | The menu bar to be used by this console frame, or null to eliminate the menu bar |
public GObject getElement(int index)| Usage: | GObject gobj = frame.getElement(index); | ||
| Parameter: |
| ||
| Returns: | The graphical object at the specified index |
public GObject getElementAt(double x,
double y)| Usage: | GObject gobj = frame.getElementAt(x, y); | ||||
| Parameters: |
| ||||
| Returns: | The graphical object at the specified location, or null if no such object exists. |
public int getElementCount()| Usage: | int n = frame.getElementCount(); |
| Returns: | The number of graphical objects in this GCanvas |
public GCanvas getGCanvas()| Usage: | GCanvas gc = frame.getGCanvas(); |
| Returns: | The GCanvas object used by the frame |
public boolean isAutoRepaintEnabled()| Usage: | if (frame.isAutoRepaintEnabled()) . . . |
| Returns: | true if auto-repaint mode is enabled, and false otherwise |
public Iterator iterator()Applets that want to run in browsers, however, should avoid using this method, because Iterator is not supported on 1.1 browsers. For maximum portability, you should rely instead on the getElementCount and getElement methods, which provide the same functionality in a browser-compatible way.
| Usage: | Iterator i = frame.iterator(); |
| Returns: | An Iterator ranging over the elements of the container from back to front |
public Iterator iterator(int direction)for (Iterator i = frame.iterator(direction); i.hasNext(); )
Applets that want to run in browsers, however, should avoid using this method, because Iterator is not supported on 1.1 browsers. For maximum portability, you should rely instead on the getElementCount and getElement methods, which provide the same functionality in a browser-compatible way.
| Usage: | Iterator i = frame.iterator(direction); |
| Returns: | An Iterator ranging over the elements of the container in the specified direction |
public void onMouseClicked(double x,
double y)| Usage: | frame.onMouseClicked(x, y); | ||||
| Parameters: |
|
public void onMouseDragged(double x,
double y)| Usage: | frame.onMouseDragged(x, y); | ||||
| Parameters: |
|
public void onMouseMoved(double x,
double y)| Usage: | frame.onMouseMoved(x, y); | ||||
| Parameters: |
|
public void onMousePressed(double x,
double y)| Usage: | frame.onMousePressed(x, y); | ||||
| Parameters: |
|
public void onMouseReleased(double x,
double y)| Usage: | frame.onMouseReleased(x, y); | ||||
| Parameters: |
|
public void remove(GObject gobj)| Usage: | frame.remove(gobj); | ||
| Parameter: |
|
public void removeAll()| Usage: | frame.removeAll(); |
public void removeAllComponents()| Usage: | frame.removeAllComponents(); |
public void setAutoRepaintEnabled(boolean state)| Usage: | frame.setAutoRepaintEnabled(state); | ||
| Parameter: |
|
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||