diff options
author | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-01-31 01:12:47 +0000 |
---|---|---|
committer | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-01-31 01:12:47 +0000 |
commit | d89aa4a2cc8abf77d2acaebc916e089a2bb910ef (patch) | |
tree | 602bf443b89c3d98c0471d4cbf8d8e7277763c3d /java/apps/NexusII/classes | |
parent | cc9493900799d4488ba598531d5717a46b1c00e6 (diff) | |
download | ATCD-d89aa4a2cc8abf77d2acaebc916e089a2bb910ef.tar.gz |
awtCommand files added. These files are required for the Java-ACE chat
application.
Diffstat (limited to 'java/apps/NexusII/classes')
18 files changed, 1812 insertions, 0 deletions
diff --git a/java/apps/NexusII/classes/awtCommand/CApplet.class b/java/apps/NexusII/classes/awtCommand/CApplet.class Binary files differnew file mode 100644 index 00000000000..3af0361de76 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CApplet.class diff --git a/java/apps/NexusII/classes/awtCommand/CApplet.java b/java/apps/NexusII/classes/awtCommand/CApplet.java new file mode 100644 index 00000000000..a8680d9abf3 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CApplet.java @@ -0,0 +1,199 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; +import java.applet.*; + +public class CApplet extends Applet { + + protected Command gotFocusCommand = null, + lostFocusCommand = null; + protected Command mouseDownCommand = null, + mouseDragCommand = null, + mouseEnterCommand = null, + mouseExitCommand = null, + mouseMoveCommand = null, + mouseUpCommand = null; + protected Command keyUpCommand = null, + keyDownCommand = null; + + /** + * Constructs a new CApplet. + */ + public CApplet() { + super(); + } + + /* + * event handling methods + */ + + /** + * Called if the window gains focus. This results in a call to + * the gotFocusCommand object with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the window loses focus. This results in a call to + * the lostFocusCommand object with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse is down. + * This results in a call to the mouseDownCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDown(Event evt, int x, int y) { + if (mouseDownCommand != null) + mouseDownCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is dragged. + * This results in a call to the mouseDragCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDrag(Event evt, int x, int y) { + if (mouseDragCommand != null) + mouseDragCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse enters the window. + * This results in a call to the mouseEnterCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseEnter(Event evt, int x, int y) { + if (mouseEnterCommand != null) + mouseEnterCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse moves inside the window. + * This results in a call to the mouseMoveCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseMove(Event evt, int x, int y) { + if (mouseExitCommand != null) + mouseExitCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is up. + * This results in a call to the mouseUpCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseUp(Event evt, int x, int y) { + if (mouseUpCommand != null) + mouseUpCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if a character is pressed. + * This results in a call to the keyDownCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyDown(Event evt, int key) { + if (keyDownCommand != null) + keyDownCommand.execute(this, evt, new Integer(key)); + return false; + } + + /** + * Called if a character is released. + * This results in a call to the keyUpCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyUp(Event evt, int key) { + if (keyUpCommand != null) + keyUpCommand.execute(this, evt, new Integer(key)); + return false; + } + + + /* + * set...Command methods + */ + + + /** + * Sets the mouseDownCommand object. + */ + public void setMouseDownCommand(Command c) { + mouseDownCommand = c; + } + + /** + * Sets the moueDragCommand object. + */ + public void setMouseDragCommand(Command c) { + mouseDragCommand = c; + } + + /** + * Sets the mouseEnterCommand object. + */ + public void setMouseEnterCommand(Command c) { + mouseEnterCommand = c; + } + + /** + * Sets the mouseExitCommand object. + */ + public void setMouseExitCommand(Command c) { + mouseExitCommand = c; + } + + /** + * Sets the mouseMoveCommand object. + */ + public void setMouseMoveCommand(Command c) { + mouseMoveCommand = c; + } + + /** + * Sets the mouseUpCommand object. + */ + public void setMouseUpCommand(Command c) { + mouseUpCommand = c; + } + + /** + * Sets the keyDownCommand object. + */ + public void setKeyDownCommand(Command c) { + keyDownCommand = c; + } + + /** + * Sets the keyUpCommand object. + */ + public void setKeyUpCommand(Command c) { + keyUpCommand = c; + } +} diff --git a/java/apps/NexusII/classes/awtCommand/CButton.class b/java/apps/NexusII/classes/awtCommand/CButton.class Binary files differnew file mode 100644 index 00000000000..b64fecd5bbf --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CButton.class diff --git a/java/apps/NexusII/classes/awtCommand/CButton.java b/java/apps/NexusII/classes/awtCommand/CButton.java new file mode 100644 index 00000000000..ff0f3385bad --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CButton.java @@ -0,0 +1,41 @@ + +package awtCommand; + +import java.lang.*; +import java.awt.*; + +public class CButton extends java.awt.Button { + protected Command actionCommand = null; + + /** + * Constructs a CButton. + */ + public CButton() { + super(); + } + + /** + * Constructs a CButton with the given name. + */ + public CButton(String name) { + super(name); + } + + /** + * Sets the actionCommand object. + */ + public void setActionCommand(Command action) { + actionCommand = action; + } + + /** + * Called when the button is selected.. + * This results in a call to the actionCommand object + * with <code>what</code> set to the button's label. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } +} diff --git a/java/apps/NexusII/classes/awtCommand/CCanvas.class b/java/apps/NexusII/classes/awtCommand/CCanvas.class Binary files differnew file mode 100644 index 00000000000..5d697017b5b --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CCanvas.class diff --git a/java/apps/NexusII/classes/awtCommand/CCanvas.java b/java/apps/NexusII/classes/awtCommand/CCanvas.java new file mode 100644 index 00000000000..837b6f56f7a --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CCanvas.java @@ -0,0 +1,381 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; + +public class CCanvas extends Canvas { + + protected Command gotFocusCommand = null, + lostFocusCommand = null; + protected Command mouseDownCommand = null, + mouseDragCommand = null, + mouseEnterCommand = null, + mouseExitCommand = null, + mouseMoveCommand = null, + mouseUpCommand = null; + protected Command keyUpCommand = null, + keyDownCommand = null; + protected Command actionCommand = null; + protected Command scrollAbsoluteCommand = null, + lineDownCommand = null, + lineUpCommand = null, + pageDownCommand = null, + pageUpCommand = null; + protected Command selectCommand = null, + deselectCommand = null; + + + /** + * Constructs a new CCanvas. + */ + public CCanvas() { + super(); + } + + /** + * Handles the event. + * Calls methods for variousL events and passes + * others to its superclass method. + */ + public boolean handleEvent(Event evt) { + switch (evt.id) { + case Event.SCROLL_ABSOLUTE: + return scrollAbsolute(evt, evt.arg); + case Event.SCROLL_LINE_DOWN: + return lineDown(evt, evt.arg); + case Event.SCROLL_LINE_UP: + return lineUp(evt, evt.arg); + case Event.SCROLL_PAGE_DOWN: + return pageDown(evt, evt.arg); + case Event.SCROLL_PAGE_UP: + return pageUp(evt, evt.arg); + case Event.LIST_SELECT: + return select(evt, evt.arg); + case Event.LIST_DESELECT: + return deselect(evt, evt.arg); + default: + return super.handleEvent(evt); + } + } + + + /* + * event handling methods + */ + + /** + * Called if the window gains focus. This results in a call to + * the gotFocusCommand object with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the window loses focus. This results in a call to + * the lostFocusCommand object with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse is down. + * This results in a call to the mouseDownCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDown(Event evt, int x, int y) { + if (mouseDownCommand != null) + mouseDownCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is dragged. + * This results in a call to the mouseDragCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDrag(Event evt, int x, int y) { + if (mouseDragCommand != null) + mouseDragCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse enters the window. + * This results in a call to the mouseEnterCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseEnter(Event evt, int x, int y) { + if (mouseEnterCommand != null) + mouseEnterCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse moves inside the window. + * This results in a call to the mouseMoveCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseMove(Event evt, int x, int y) { + if (mouseExitCommand != null) + mouseExitCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is up. + * This results in a call to the mouseUpCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseUp(Event evt, int x, int y) { + if (mouseUpCommand != null) + mouseUpCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if a character is pressed. + * This results in a call to the keyDownCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyDown(Event evt, int key) { + if (keyDownCommand != null) + keyDownCommand.execute(this, evt, new Integer(key)); + return false; + } + + /** + * Called if a character is released. + * This results in a call to the keyUpCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyUp(Event evt, int key) { + if (keyUpCommand != null) + keyUpCommand.execute(this, evt, new Integer(key)); + return false; + } + + /** + * Called when an ACTION_EVENT is generated. + * This results in a call to the actionCommand object + * with <code>what</code> set to the event's arg. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is dragged. + * This results in a call to the scrollAbsoluteCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean scrollAbsolute(Event evt, Object what) { + if (scrollAbsoluteCommand != null) + scrollAbsoluteCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented down. + * This results in a call to the lineDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineDown(Event evt, Object what) { + if (lineDownCommand != null) + lineDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented up. + * This results in a call to the lineUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineUp(Event evt, Object what) { + if (lineUpCommand != null) + lineUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages up. + * This results in a call to the pageUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageUp(Event evt, Object what) { + if (pageUpCommand != null) + pageUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages down. + * This results in a call to the pageDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageDown(Event evt, Object what) { + if (pageDownCommand != null) + pageDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse selects an item in a List. + * This results in a call to the selectCommand object + * with <code>what</code> set to the selected index. + */ + public boolean select(Event evt, Object what) { + if (selectCommand != null) + selectCommand.execute(this, evt, what); + return false; + } + + + /** + * Called if the mouse deselects an item in a List. + * This results in a call to the deselectCommand object + * with <code>what</code> set to the deselected index. + */ + public boolean deselect(Event evt, Object what) { + if (deselectCommand != null) + deselectCommand.execute(this, evt, what); + return false; + } + + + /* + * set...Command methods + */ + + + + /** + * Sets the mouseDownCommand object. + */ + public void setMouseDownCommand(Command c) { + mouseDownCommand = c; + } + + /** + * Sets the moueDragCommand object. + */ + public void setMouseDragCommand(Command c) { + mouseDragCommand = c; + } + + /** + * Sets the mouseEnterCommand object. + */ + public void setMouseEnterCommand(Command c) { + mouseEnterCommand = c; + } + + /** + * Sets the mouseExitCommand object. + */ + public void setMouseExitCommand(Command c) { + mouseExitCommand = c; + } + + /** + * Sets the mouseMoveCommand object. + */ + public void setMouseMoveCommand(Command c) { + mouseMoveCommand = c; + } + + /** + * Sets the mouseUpCommand object. + */ + public void setMouseUpCommand(Command c) { + mouseUpCommand = c; + } + + /** + * Sets the keyDownCommand object. + */ + public void setKeyDownCommand(Command c) { + keyDownCommand = c; + } + + /** + * Sets the keyUpCommand object. + */ + public void setKeyUpCommand(Command c) { + keyUpCommand = c; + } + + /** + * Sets the actionCommand object. + */ + public void setActionCommand(Command action) { + actionCommand = action; + } + + /** + * Sets the scrollAbsoluteCommand. + */ + public void setScrollAbsoluteCommand(Command c) { + scrollAbsoluteCommand = c; + } + + /** + * Sets the lineUpCommand. + */ + public void setLineUpCommand(Command c) { + lineUpCommand = c; + } + + /** + * Sets the lineDownCommand. + */ + public void setLineDownCommand(Command c) { + lineDownCommand = c; + } + + /** + * Sets the pageUpCommand. + */ + public void setPageUpCommand(Command c) { + pageUpCommand = c; + } + + /** + * Sets the pageDownCommand. + */ + public void setPageDownCommand(Command c) { + pageDownCommand = c; + } + + /** + * Sets the selectCommand. + */ + public void setSelectCommand(Command select) { + selectCommand = select; + } + + /** + * Sets the deselectCommand. + */ + public void setDeselectCommand(Command deselect) { + deselectCommand = deselect; + } + +} diff --git a/java/apps/NexusII/classes/awtCommand/CFrame.class b/java/apps/NexusII/classes/awtCommand/CFrame.class Binary files differnew file mode 100644 index 00000000000..66f25773c76 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CFrame.class diff --git a/java/apps/NexusII/classes/awtCommand/CFrame.java b/java/apps/NexusII/classes/awtCommand/CFrame.java new file mode 100644 index 00000000000..f63d3ce8b9a --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CFrame.java @@ -0,0 +1,486 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; + +public class CFrame extends Frame { + + protected Command destroyCommand = null, + deiconifyCommand = null, + iconifyCommand = null, + movedCommand = null; + protected Command gotFocusCommand = null, + lostFocusCommand = null; + protected Command mouseDownCommand = null, + mouseDragCommand = null, + mouseEnterCommand = null, + mouseExitCommand = null, + mouseMoveCommand = null, + mouseUpCommand = null; + protected Command keyUpCommand = null, + keyDownCommand = null; + protected Command actionCommand = null; + protected Command scrollAbsoluteCommand = null, + lineDownCommand = null, + lineUpCommand = null, + pageDownCommand = null, + pageUpCommand = null; + protected Command selectCommand = null, + deselectCommand = null; + + /** + * Constructs a new, initially invisible CFrame. + */ + public CFrame() { + super(); + } + + /** + * Constructs a new, initially invisible CFrame with the + * specified title. + */ + public CFrame(String title) { + super(title); + } + + /** + * Handles the event + */ + public boolean handleEvent(Event evt) { + switch (evt.id) { + case Event.WINDOW_DESTROY: + return windowDestroy(evt); + case Event.WINDOW_DEICONIFY: + return windowDeiconify(evt); + case Event.WINDOW_ICONIFY: + return windowIconify(evt); + case Event.WINDOW_MOVED: + return windowMoved(evt); + case Event.SCROLL_ABSOLUTE: + return scrollAbsolute(evt, evt.arg); + case Event.SCROLL_LINE_DOWN: + return lineDown(evt, evt.arg); + case Event.SCROLL_LINE_UP: + return lineUp(evt, evt.arg); + case Event.SCROLL_PAGE_DOWN: + return pageDown(evt, evt.arg); + case Event.SCROLL_PAGE_UP: + return pageUp(evt, evt.arg); + case Event.LIST_SELECT: + return select(evt, evt.arg); + case Event.LIST_DESELECT: + return deselect(evt, evt.arg); + default: + return super.handleEvent(evt); + } + } + + /* + * event handling methods + */ + + /** + * Called if the dialog's window is destroyed. This results in a call to + * the destroyCommand object with <code>what</code> set to null + */ + public boolean windowDestroy(Event evt) { + if (destroyCommand != null) + destroyCommand.execute(this, evt, null); + return false; + } + + /** + * Called if the dialog's window is deiconified. This results in a call to + * the deiconifyCommand object with <code>what</code> set to null + */ + public boolean windowDeiconify(Event evt) { + if (deiconifyCommand != null) + deiconifyCommand.execute(this, evt, null); + return false; + } + + /** + * Called if the dialog is iconified. This results in a call to + * the iconifyCommand object with <code>what</code> set to null + */ + public boolean windowIconify(Event evt) { + if (iconifyCommand != null) + iconifyCommand.execute(this, evt, null); + return false; + } + + /** + * Called if the dialog's window is moved. This results in a call to + * the movedCommand object with <code>what</code> set to Point(x, y) + */ + public boolean windowMoved(Event evt) { + if (movedCommand != null) + movedCommand.execute(this, evt, new Point(evt.x, evt.y)); + return false; + } + + /* + * I don't know where what objects this next set should belong + * to. Putting them at the top is ok for now + */ + + /** + * Called if the window gains focus. This results in a call to + * the gotFocusCommand object with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the window loses focus. This results in a call to + * the lostFocusCommand object with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse is down. + * This results in a call to the mouseDownCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDown(Event evt, int x, int y) { + if (mouseDownCommand != null) + mouseDownCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is dragged. + * This results in a call to the mouseDragCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDrag(Event evt, int x, int y) { + if (mouseDragCommand != null) + mouseDragCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse enters the window. + * This results in a call to the mouseEnterCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseEnter(Event evt, int x, int y) { + if (mouseEnterCommand != null) + mouseEnterCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse moves inside the window. + * This results in a call to the mouseMoveCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseMove(Event evt, int x, int y) { + if (mouseExitCommand != null) + mouseExitCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is up. + * This results in a call to the mouseUpCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseUp(Event evt, int x, int y) { + if (mouseUpCommand != null) + mouseUpCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if a character is pressed. + * This results in a call to the keyDownCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyDown(Event evt, int key) { + if (keyDownCommand != null) + keyDownCommand.execute(this, evt, new Integer(key)); + return false; + } + + /** + * Called if a character is released. + * This results in a call to the keyUpCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyUp(Event evt, int key) { + if (keyUpCommand != null) + keyUpCommand.execute(this, evt, new Integer(key)); + return false; + } + + + /** + * Called when an ACTION_EVENT is generated. + * This results in a call to the actionCommand object + * with <code>what</code> set to the event's arg. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is dragged. + * This results in a call to the scrollAbsoluteCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean scrollAbsolute(Event evt, Object what) { + if (scrollAbsoluteCommand != null) + scrollAbsoluteCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented down. + * This results in a call to the lineDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineDown(Event evt, Object what) { + if (lineDownCommand != null) + lineDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented up. + * This results in a call to the lineUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineUp(Event evt, Object what) { + if (lineUpCommand != null) + lineUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages up. + * This results in a call to the pageUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageUp(Event evt, Object what) { + if (pageUpCommand != null) + pageUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages down. + * This results in a call to the pageDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageDown(Event evt, Object what) { + if (pageDownCommand != null) + pageDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse selects an item in a List. + * This results in a call to the selectCommand object + * with <code>what</code> set to the selected index. + */ + public boolean select(Event evt, Object what) { + if (selectCommand != null) + selectCommand.execute(this, evt, what); + return false; + } + + + /** + * Called if the mouse deselects an item in a List. + * This results in a call to the deselectCommand object + * with <code>what</code> set to the deselected index. + */ + public boolean deselect(Event evt, Object what) { + if (deselectCommand != null) + deselectCommand.execute(this, evt, what); + return false; + } + + + /* + * set...Command methods + */ + + + /** + * Sets the destroyCommand object. + */ + public void setDestroyCommand(Command c) { + destroyCommand = c; + } + + /** + * Sets the deiconifyCommand object. + */ + public void setDeiconifyCommand(Command c) { + deiconifyCommand = c; + } + + /** + * Sets the iconifyCommand object. + */ + public void setIconifyCommand(Command c) { + iconifyCommand = c; + } + + /** + * Sets the movedCommand object. + */ + public void setMovedCommand(Command c) { + movedCommand = c; + } + + /** + * Sets the mouseDownCommand object. + */ + public void setMouseDownCommand(Command c) { + mouseDownCommand = c; + } + + /** + * Sets the moueDragCommand object. + */ + public void setMouseDragCommand(Command c) { + mouseDragCommand = c; + } + + /** + * Sets the mouseEnterCommand object. + */ + public void setMouseEnterCommand(Command c) { + mouseEnterCommand = c; + } + + /** + * Sets the mouseExitCommand object. + */ + public void setMouseExitCommand(Command c) { + mouseExitCommand = c; + } + + /** + * Sets the mouseMoveCommand object. + */ + public void setMouseMoveCommand(Command c) { + mouseMoveCommand = c; + } + + /** + * Sets the mouseUpCommand object. + */ + public void setMouseUpCommand(Command c) { + mouseUpCommand = c; + } + + /** + * Sets the keyDownCommand object. + */ + public void setKeyDownCommand(Command c) { + keyDownCommand = c; + } + + /** + * Sets the keyUpCommand object. + */ + public void setKeyUpCommand(Command c) { + keyUpCommand = c; + } + + /** + * Sets the actionCommand object. + */ + public void setActionCommand(Command action) { + actionCommand = action; + } + + /** + * Sets the scrollAbsoluteCommand. + */ + public void setScrollAbsoluteCommand(Command c) { + scrollAbsoluteCommand = c; + } + + /** + * Sets the lineUpCommand. + */ + public void setLineUpCommand(Command c) { + lineUpCommand = c; + } + + /** + * Sets the lineDownCommand. + */ + public void setLineDownCommand(Command c) { + lineDownCommand = c; + } + + /** + * Sets the pageUpCommand. + */ + public void setPageUpCommand(Command c) { + pageUpCommand = c; + } + + /** + * Sets the pageDownCommand. + */ + public void setPageDownCommand(Command c) { + pageDownCommand = c; + } + + /** + * Sets the selectCommand. + */ + public void setSelectCommand(Command select) { + selectCommand = select; + } + + public void setGotFocusCommand(Command c) { + gotFocusCommand = c ; + } + /** + * Sets the deselectCommand. + */ + public void setDeselectCommand(Command deselect) { + deselectCommand = deselect; + } + +} + + + + + + + + + + + + + diff --git a/java/apps/NexusII/classes/awtCommand/CList.class b/java/apps/NexusII/classes/awtCommand/CList.class Binary files differnew file mode 100644 index 00000000000..c595ce7786b --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CList.class diff --git a/java/apps/NexusII/classes/awtCommand/CList.java b/java/apps/NexusII/classes/awtCommand/CList.java new file mode 100644 index 00000000000..110e6a01db2 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CList.java @@ -0,0 +1,96 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + + +package awtCommand; + +import java.awt.*; + +public class CList extends List { + protected Command selectCommand = null; + protected Command deselectCommand = null; + protected Command actionCommand = null; + + /** + * Handles the event + */ + public boolean handleEvent(Event evt) { + switch (evt.id) { + case Event.LIST_SELECT: + return select(evt, evt.arg); + case Event.LIST_DESELECT: + return deselect(evt, evt.arg); + default: + return super.handleEvent(evt); + } + } + + /* + * event handling methods + */ + + + /** + * Called if the Enter key is pressed. + * This results in a call to the actionCommand object + * with <code>what</code> set to the selected item. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse selects an item. + * This results in a call to the selectCommand object + * with <code>what</code> set to the selected index. + */ + public boolean select(Event evt, Object what) { + if (selectCommand != null) + selectCommand.execute(this, evt, what); + return false; + } + + + /** + * Called if the mouse deselects an item. + * This results in a call to the deselectCommand object + * with <code>what</code> set to the deselected index. + */ + public boolean deselect(Event evt, Object what) { + if (deselectCommand != null) + deselectCommand.execute(this, evt, what); + return false; + } + + + /** + * Sets the actionCommand. + */ + public void setActionCommand(Command action) { + actionCommand = action; + } + + /** + * Sets the selectCommand. + */ + public void setSelectCommand(Command select) { + selectCommand = select; + } + + /** + * Sets the deselectCommand. + */ + public void setDeselectCommand(Command deselect) { + deselectCommand = deselect; + } +} diff --git a/java/apps/NexusII/classes/awtCommand/CPanel.class b/java/apps/NexusII/classes/awtCommand/CPanel.class Binary files differnew file mode 100644 index 00000000000..d00477a30f5 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CPanel.class diff --git a/java/apps/NexusII/classes/awtCommand/CPanel.java b/java/apps/NexusII/classes/awtCommand/CPanel.java new file mode 100644 index 00000000000..1c8d39f8537 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CPanel.java @@ -0,0 +1,381 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; + +public class CPanel extends Panel { + + protected Command gotFocusCommand = null, + lostFocusCommand = null; + protected Command mouseDownCommand = null, + mouseDragCommand = null, + mouseEnterCommand = null, + mouseExitCommand = null, + mouseMoveCommand = null, + mouseUpCommand = null; + protected Command keyUpCommand = null, + keyDownCommand = null; + protected Command actionCommand = null; + protected Command scrollAbsoluteCommand = null, + lineDownCommand = null, + lineUpCommand = null, + pageDownCommand = null, + pageUpCommand = null; + protected Command selectCommand = null, + deselectCommand = null; + + /** + * Constructs a new CPanel. + */ + public CPanel() { + super(); + } + + + /** + * Handles the event. + * Calls methods for variousL events and passes + * others to its superclass method. + */ + public boolean handleEvent(Event evt) { + switch (evt.id) { + case Event.SCROLL_ABSOLUTE: + return scrollAbsolute(evt, evt.arg); + case Event.SCROLL_LINE_DOWN: + return lineDown(evt, evt.arg); + case Event.SCROLL_LINE_UP: + return lineUp(evt, evt.arg); + case Event.SCROLL_PAGE_DOWN: + return pageDown(evt, evt.arg); + case Event.SCROLL_PAGE_UP: + return pageUp(evt, evt.arg); + case Event.LIST_SELECT: + return select(evt, evt.arg); + case Event.LIST_DESELECT: + return deselect(evt, evt.arg); + default: + return super.handleEvent(evt); + } + } + + /* + * event handling methods + */ + + /** + * Called if the window gains focus. This results in a call to + * the gotFocusCommand object with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the window loses focus. This results in a call to + * the lostFocusCommand object with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse is down. + * This results in a call to the mouseDownCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDown(Event evt, int x, int y) { + if (mouseDownCommand != null) + mouseDownCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is dragged. + * This results in a call to the mouseDragCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseDrag(Event evt, int x, int y) { + if (mouseDragCommand != null) + mouseDragCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse enters the window. + * This results in a call to the mouseEnterCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseEnter(Event evt, int x, int y) { + if (mouseEnterCommand != null) + mouseEnterCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse moves inside the window. + * This results in a call to the mouseMoveCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseMove(Event evt, int x, int y) { + if (mouseExitCommand != null) + mouseExitCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if the mouse is up. + * This results in a call to the mouseUpCommand object with + * <code>what</code> set to Point(x, y) + */ + public boolean mouseUp(Event evt, int x, int y) { + if (mouseUpCommand != null) + mouseUpCommand.execute(this, evt, new Point(x, y)); + return false; + } + + /** + * Called if a character is pressed. + * This results in a call to the keyDownCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyDown(Event evt, int key) { + if (keyDownCommand != null) + keyDownCommand.execute(this, evt, new Integer(key)); + return false; + } + + /** + * Called if a character is released. + * This results in a call to the keyUpCommand object with + * <code>what</code> set to Integer(key). + */ + public boolean keyUp(Event evt, int key) { + if (keyUpCommand != null) + keyUpCommand.execute(this, evt, new Integer(key)); + return false; + } + + + /** + * Called when an ACTION_EVENT is generated. + * This results in a call to the actionCommand object + * with <code>what</code> set to the event's arg. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is dragged. + * This results in a call to the scrollAbsoluteCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean scrollAbsolute(Event evt, Object what) { + if (scrollAbsoluteCommand != null) + scrollAbsoluteCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented down. + * This results in a call to the lineDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineDown(Event evt, Object what) { + if (lineDownCommand != null) + lineDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar is incremented up. + * This results in a call to the lineUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean lineUp(Event evt, Object what) { + if (lineUpCommand != null) + lineUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages up. + * This results in a call to the pageUpCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageUp(Event evt, Object what) { + if (pageUpCommand != null) + pageUpCommand.execute(this, evt, what); + return false; + } + + /** + * Called when a scrollbar pages down. + * This results in a call to the pageDownCommand object + * with <code>what</code> set to the slider location value. + */ + public boolean pageDown(Event evt, Object what) { + if (pageDownCommand != null) + pageDownCommand.execute(this, evt, what); + return false; + } + + /** + * Called if the mouse selects an item in a List. + * This results in a call to the selectCommand object + * with <code>what</code> set to the selected index. + */ + public boolean select(Event evt, Object what) { + if (selectCommand != null) + selectCommand.execute(this, evt, what); + return false; + } + + + /** + * Called if the mouse deselects an item in a List. + * This results in a call to the deselectCommand object + * with <code>what</code> set to the deselected index. + */ + public boolean deselect(Event evt, Object what) { + if (deselectCommand != null) + deselectCommand.execute(this, evt, what); + return false; + } + + /* + * set...Command methods + */ + + + + /** + * Sets the mouseDownCommand object. + */ + public void setMouseDownCommand(Command c) { + mouseDownCommand = c; + } + + /** + * Sets the moueDragCommand object. + */ + public void setMouseDragCommand(Command c) { + mouseDragCommand = c; + } + + /** + * Sets the mouseEnterCommand object. + */ + public void setMouseEnterCommand(Command c) { + mouseEnterCommand = c; + } + + /** + * Sets the mouseExitCommand object. + */ + public void setMouseExitCommand(Command c) { + mouseExitCommand = c; + } + + /** + * Sets the mouseMoveCommand object. + */ + public void setMouseMoveCommand(Command c) { + mouseMoveCommand = c; + } + + /** + * Sets the mouseUpCommand object. + */ + public void setMouseUpCommand(Command c) { + mouseUpCommand = c; + } + + /** + * Sets the keyDownCommand object. + */ + public void setKeyDownCommand(Command c) { + keyDownCommand = c; + } + + /** + * Sets the keyUpCommand object. + */ + public void setKeyUpCommand(Command c) { + keyUpCommand = c; + } + + + /** + * Sets the actionCommand object. + */ + public void setActionCommand(Command action) { + actionCommand = action; + } + + /** + * Sets the scrollAbsoluteCommand. + */ + public void setScrollAbsoluteCommand(Command c) { + scrollAbsoluteCommand = c; + } + + /** + * Sets the lineUpCommand. + */ + public void setLineUpCommand(Command c) { + lineUpCommand = c; + } + + /** + * Sets the lineDownCommand. + */ + public void setLineDownCommand(Command c) { + lineDownCommand = c; + } + + /** + * Sets the pageUpCommand. + */ + public void setPageUpCommand(Command c) { + pageUpCommand = c; + } + + /** + * Sets the pageDownCommand. + */ + public void setPageDownCommand(Command c) { + pageDownCommand = c; + } + + /** + * Sets the selectCommand. + */ + public void setSelectCommand(Command select) { + selectCommand = select; + } + + /** + * Sets the deselectCommand. + */ + public void setDeselectCommand(Command deselect) { + deselectCommand = deselect; + } + +} diff --git a/java/apps/NexusII/classes/awtCommand/CTextArea.class b/java/apps/NexusII/classes/awtCommand/CTextArea.class Binary files differnew file mode 100644 index 00000000000..9ec6e238cdf --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CTextArea.class diff --git a/java/apps/NexusII/classes/awtCommand/CTextArea.java b/java/apps/NexusII/classes/awtCommand/CTextArea.java new file mode 100644 index 00000000000..eacaf526929 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CTextArea.java @@ -0,0 +1,93 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; + +public class CTextArea extends TextArea { + + protected Command gotFocusCommand = null, + lostFocusCommand = null; + + /** + * Constructs a new TextArea. + */ + public CTextArea() { + super(); + } + + /** + * Constructs a new TextArea with the specified number of rows and columns. + * @param rows the number of rows + * @param cols the number of columns + */ + public CTextArea(int rows, int cols) { + super(rows, cols); + } + + /** + * Constructs a new TextArea with the specified text displayed. + * @param text the text to be displayed + */ + public CTextArea(String text) { + super(text); + } + + /** + * Constructs a new TextArea with the specified text and the + * specified number of rows + * and columns. + * @param text the text to be displayed + * @param rows the number of rows + * @param cols the number of cols + */ + public CTextArea(String text, int rows, int cols) { + super(text, rows, cols); + } + + + /** + * Called when the text area gains the focus. + * This results in a call to the gotFocusCommand object + * with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called when the text area loses the focus. + * This results in a call to the lostFocusCommand object + * with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Sets the gotFocusCommand object. + */ + public void setGotFocusCommand(Command c) { + gotFocusCommand = c; + } + + /** + * Sets the lostFocusCommand object. + */ + public void setLostFocusCommand(Command c) { + lostFocusCommand = c; + } +} diff --git a/java/apps/NexusII/classes/awtCommand/CTextField.class b/java/apps/NexusII/classes/awtCommand/CTextField.class Binary files differnew file mode 100644 index 00000000000..6f298a43348 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CTextField.class diff --git a/java/apps/NexusII/classes/awtCommand/CTextField.java b/java/apps/NexusII/classes/awtCommand/CTextField.java new file mode 100644 index 00000000000..146f13206e5 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/CTextField.java @@ -0,0 +1,110 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +package awtCommand; + +import java.awt.*; + +public class CTextField extends TextField { + + protected Command actionCommand = null, + gotFocusCommand = null, + lostFocusCommand = null; + + /** + * Constructs a new CTextField. + */ + public CTextField() { + super(); + } + + /** + * Constructs a new CTextField initialized with the specified columns. + * @param cols the number of columns + */ + public CTextField(int cols) { + super(cols); + } + + /** + * Constructs a new CTextField initialized with the specified text. + * @param text the text to be displayed + */ + public CTextField(String text) { + super(text); + } + + + /** + * Constructs a new CTextField initialized with the specified text and columns. + * @param text the text to be displayed + * @param cols the number of columns + */ + public CTextField(String text, int cols) { + super(text, cols); + } + + + /** + * Called when Enter is pressed in the text field. + * This results in a call to the actionCommand object + * with <code>what</code> set to the text contents. + */ + public boolean action(Event evt, Object what) { + if (actionCommand != null) + actionCommand.execute(this, evt, what); + return false; + } + + /** + * Called when the text field gains the focus. + * This results in a call to the gotFocusCommand object + * with <code>what</code> set to null. + */ + public boolean gotFocus(Event evt, Object what) { + if (gotFocusCommand != null) + gotFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Called when the text field loses the focus. + * This results in a call to the lostFocusCommand object + * with <code>what</code> set to null. + */ + public boolean lostFocus(Event evt, Object what) { + if (lostFocusCommand != null) + lostFocusCommand.execute(this, evt, what); + return false; + } + + /** + * Sets the actionCommand object. + */ + public void setActionCommand(Command c) { + actionCommand = c; + } + + + /** + * Sets the gotFocusCommand object. + */ + public void setGotFocusCommand(Command c) { + gotFocusCommand = c; + } + + /** + * Sets the lostFocusCommand object. + */ + public void setLostFocusCommand(Command c) { + lostFocusCommand = c; + } +} diff --git a/java/apps/NexusII/classes/awtCommand/Command.class b/java/apps/NexusII/classes/awtCommand/Command.class Binary files differnew file mode 100644 index 00000000000..6b3c12c24f7 --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/Command.class diff --git a/java/apps/NexusII/classes/awtCommand/Command.java b/java/apps/NexusII/classes/awtCommand/Command.java new file mode 100644 index 00000000000..373c7a363cf --- /dev/null +++ b/java/apps/NexusII/classes/awtCommand/Command.java @@ -0,0 +1,25 @@ +/* + * Copyright 1996 Jan Newmarch, University of Canberra. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The author + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + + + +package awtCommand; + +import java.awt.*; + +public interface Command { + + /** + * Executes application logic. + * Called by events occurring in associated objects + */ + public abstract void execute(Object target, Event evt, Object what); +} |