com.oxfordmathcenter.breadboards
Class TwoButtonBreadboard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by acm.program.Program
                          extended by acm.program.GraphicsProgram
                              extended by com.oxfordmathcenter.breadboards.AbstractBreadboard
                                  extended by com.oxfordmathcenter.breadboards.TwoButtonBreadboard
All Implemented Interfaces:
acm.io.IOModel, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer

public class TwoButtonBreadboard
extends AbstractBreadboard

Provides a simple graphical user interface consisting of an area to display text, a text field for entering text, and a single button labeled "Go" by default.

Author:
paul oser
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class acm.program.Program
CENTER, EAST, NORTH, SOUTH, WEST
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TwoButtonBreadboard()
           
 
Method Summary
 javax.swing.JButton getButton1()
          Returns the left-most button on the form
 javax.swing.JButton getButton2()
          Returns the right-most button on the form
 javax.swing.JTextArea getTextArea()
          Returns the textArea at the top of the breadboard window.
 javax.swing.JTextField getTextField()
          Gets any text entered in the edit box at the bottom of the window
 void init()
          Sets window size and layout
 void onButton1Click()
          This routine is called when the user hits the "Button1" button -- this method should be overridden.
 void onButton2Click()
          This routine is called when the user hits the "Button2" button -- this method should be overridden.
 void run()
          This routine gets called when the program starts running -- this method should be overridden.
 
Methods inherited from class com.oxfordmathcenter.breadboards.AbstractBreadboard
getTimer, getTimerDelay, onMouseClick, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onTimerTick, paintBreadboardCanvas
 
Methods inherited from class acm.program.GraphicsProgram
add, add, add, add, add, addKeyListeners, addKeyListeners, addMouseListeners, addMouseListeners, getElement, getElementAt, getElementAt, getElementCount, getGCanvas, iterator, iterator, remove, removeAll, removeAllComponents, repaint, setBackground, startGraphicsProgram, waitForClick
 
Methods inherited from class acm.program.Program
actionPerformed, add, addActionListeners, addActionListeners, addExitHook, destroy, exit, getCentralRegionSize, getConsole, getDialog, getHeight, getInputModel, getLayout, getMainThread, getMenuBar, getOutputModel, getParameter, getPreferredSize, getReader, getRegionPanel, getTitle, getWidth, getWriter, isAppletMode, keyPressed, keyReleased, keyTyped, main, menuAction, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, pause, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, readBoolean, readBoolean, readBoolean, readDouble, readDouble, readDouble, readDouble, readInt, readInt, readInt, readInt, readLine, readLine, remove, remove, setConsole, setDialog, setInputModel, setLayout, setOutputModel, setParameter, setTitle, showErrorMessage, start, start, validate
 
Methods inherited from class javax.swing.JApplet
getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TwoButtonBreadboard

public TwoButtonBreadboard()
Method Detail

init

public void init()
Sets window size and layout

Overrides:
init in class acm.program.GraphicsProgram

getTextArea

public javax.swing.JTextArea getTextArea()
Returns the textArea at the top of the breadboard window.

Returns:
textArea at the top of the breadboard window

getButton1

public javax.swing.JButton getButton1()
Returns the left-most button on the form

Returns:
the left-most button, the one with the initial text "Button1"

getButton2

public javax.swing.JButton getButton2()
Returns the right-most button on the form

Returns:
the right-most button, the one with the initial text "Button2"

getTextField

public javax.swing.JTextField getTextField()
Gets any text entered in the edit box at the bottom of the window

Returns:
the text entered in the edit box at the bottom of the window

onButton1Click

public void onButton1Click()
This routine is called when the user hits the "Button1" button -- this method should be overridden.


onButton2Click

public void onButton2Click()
This routine is called when the user hits the "Button2" button -- this method should be overridden.


run

public void run()
This routine gets called when the program starts running -- this method should be overridden.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class acm.program.GraphicsProgram