public class ControlPanel
extends javax.swing.JFrame
Constructing a ControlPanel causes the appearance of an empty panel with a given title. User code can create buttons, checkboxes, sliders, and input- and output- text areas, and link them to user code of their choice with a simple connect() method.
Modifier and Type | Field and Description |
---|---|
static int |
Button
connect() argument for a button
|
static int |
CheckBox
connect() argument for a check box
|
static int |
Slider
connect() argument for a slider
|
static int |
TextIn
connect() argument for text input area
|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
ControlPanel(java.lang.String title)
Creates an empty control panel, on which the user can place buttons,
check boxes and sliders.
|
Modifier and Type | Method and Description |
---|---|
void |
addText(java.lang.String text)
append text to the text output window
|
void |
connect(java.lang.Object userObject,
int type,
int number,
int start,
int low,
int high,
int id,
java.lang.String label,
java.lang.String method)
display and connect a panel's control to a user-specified method
|
void |
connect(java.lang.Object userObject,
int type,
int number,
int id,
java.lang.String label,
java.lang.String method)
display and connect a panel's control to a user-specified method
|
void |
setText(boolean visible)
Set the visibility of the text output area
|
void |
setText(java.lang.String text)
set text in the text output area
|
void |
textInInstant(boolean textInInstant)
Controls when the text handler is called.
|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int Button
public static final int CheckBox
public static final int Slider
public static final int TextIn
public ControlPanel(java.lang.String title)
title
- the title to display on the top of the panelpublic void textInInstant(boolean textInInstant)
textInInstant
- true means call the handler after any key stroke; false means call only after ENTERpublic void setText(boolean visible)
visible
- make text output area visible (true) or invisible (false)public void setText(java.lang.String text)
text
- string to displaypublic void addText(java.lang.String text)
text
- string to append to text output windowpublic void connect(java.lang.Object userObject, int type, int number, int id, java.lang.String label, java.lang.String method)
userObject
- usually "this": the object whose method should be calledtype
- one of ControlPanel.Button, CheckBox, Slider or TextInnumber
- index (0-n) of the controlid
- user-specified integer to identify this control. Will be passed as the first argument to the methodlabel
- string to display on the buttonmethod
- string containing the name of the method to call when the control changes.
method is called with a ControlArgs object as its single argumentpublic void connect(java.lang.Object userObject, int type, int number, int start, int low, int high, int id, java.lang.String label, java.lang.String method)
userObject
- usually "this": the object whose method should be calledtype
- one of ControlPanel.Button, CheckBox, Slider or TextInnumber
- index (0-n) of the controllow
- lower limit of sliderhigh
- upper limit of sliderstart
- initial starting valueid
- user-specified integer to identify this control. Will be passed as the first argument to the methodlabel
- string to display on the buttonmethod
- string containing the name of the method to call when the control changes.
method is called with a ControlArgs object as its single argument