|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel net.sourceforge.webcompmath.draw.LimitControlPanel
public class LimitControlPanel
A LimitControlPanel has four input boxes for specifying the xmin, xmax, ymin, and ymax of a CoodinateRect. You can actually add more than one CoordinteRect to the LimitControlPanel. This will synchronize the coordinate systems on the all the CoordinateRects that is controlls.
A LimitControlPanel can also contain a number of standard buttons, such as buttons for zooming the coordinates in and out. The buttons are specfied using constants defined in this class. It is possible to obtain standard buttons so that they can be displayed outside the LimitControlPanel. Furthermore, it is also possible to add other components to the panel, using the addRange(), addComponent(), and addComponentPair() methods. (The standard add() method from the Component class is overridded to call addComponent().) Any VariableInput added to the LimitControl Panel will appear with its name as a label, just above the input box.
Ordinarily, all the components are just stacked up vertically. However, if you set the useTwoColumnsIfPossible property to true, then they will be in two columns, unless the width of the Panel is too small for two columns. Pairs of items added with addRange() or addComponentPair() will appear on the same row. An item added with addComponent() will appear on a row by itself. As for the standard buttons, the following pairs will appear together, IF they are added at the same time: SET_LIMITS and EQUALUIZE; ZOOM_IN and ZOOM_OUT; SAVE and RESTORE.
A LimitControlPanel can have an error reporter, which is used to report any errors that are found in the input boxes for xmin, xmax, ymin, ymax (or other VariableInputs added with addRange()). Except for these input boxes, other coponents are NOT checked for errors.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
ALL_BUTTONS
A constant that can be used in the addButton() method to add all possible buttons to the LimitControlPanel. |
protected java.util.Vector |
animatorItems
pkhg 050430 animator problem Vector of Animators, which should be paused, if a WcmError occurs. |
protected static java.lang.String[] |
buttonNames
Names of the buttons |
protected int |
buttons
Set of installed buttons. |
protected CoordinateRect |
coords
The first CoordinateRect tied to this LimitControlPanel. |
static int |
EQUALIZE
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
protected ErrorReporter |
errorReporter
For reporting errors in user input. |
protected java.util.Vector |
items
Vector of components and component pairs that have been added to this panel, including at least the xmin, xmax, ymin, ymax input boxes. |
static int |
RESTORE
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
static int |
SAVE
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
protected long |
serialNumber
This is increased when the user changes the limits. |
static int |
SET_LIMITS
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
protected Tie |
syncWith
A Tie holding this panel and the CoordinateRects that it controls. |
protected boolean |
twoColumn
Use two columns for display, if possible. |
protected VariableInput |
xmax
The input box for the maximum x value. |
protected VariableInput |
xmin
The input box for the minimum x value. |
protected VariableInput |
ymax
The input box for the maximum y value. |
protected VariableInput |
ymin
The input box for the minimum y value. |
static int |
ZOOM_IN
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
static int |
ZOOM_OUT
A constant that can be used in the addButton() method to add a button to the LimitControlPanel. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 | |
---|---|
LimitControlPanel()
Create a LimitControlPanel containing input boxes labeled "xmin", "xmax", "ymin", "ymax" and a SET_LIMITS button. |
|
LimitControlPanel(int buttonsToAdd,
boolean useTwoColumnsIfPossible)
Create a LimitControlPanel containing input boxes labeled "xmin", "xmax", "ymin", "ymax" and whatever buttons are in the set specified by the first parameter. |
|
LimitControlPanel(java.lang.String xminName,
java.lang.String xmaxName,
java.lang.String yminName,
java.lang.String ymaxName,
int buttonsToAdd,
boolean useTwoColumnsIfPossible)
Create a LimitControlPanel containing input boxes labeled with the given names and containing whatever buttons are in the set buttonsToAdd. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Handle a click on one of the standard buttons. |
javax.swing.JComponent |
add(javax.swing.JComponent c)
Redefine this method from the JComponent class to make it a synonym for addComponent(c); |
void |
addAnimator(Animator animator)
pkhg 050430 |
void |
addButtons(int buttonSet)
Add the buttons in buttonSet to the panel, if they are not already there. |
void |
addComponent(javax.swing.JComponent c)
Add a component to the panel. |
void |
addComponentPair(javax.swing.JComponent c1,
javax.swing.JComponent c2)
Add two components to the panel. |
void |
addCoords(CoordinateRect coords)
Add a CoordinateRect to be controlled by this LimitControlPanel. |
void |
addCoords(DisplayCanvas canvas)
Add the first CoordinateRect from the canvas to be controlled by this LimitControlPanel. |
void |
addRange(VariableInput v1,
VariableInput v2)
Add two VariableInputs to the panel. |
void |
checkInput()
Check the input boxes in this panel. |
javax.swing.JButton |
getButton(int buttonCode)
Get a Button corresponding to one of the six button types defined by the constants SET_LIMITS, EQUALIZE, ZOOM_IN, ZOOM_OUT, SAVE, and RESTORE in this class. |
protected int |
getButtonOptions()
Get the button options; meant to be used only by WCMLimitControlPanelBean |
ErrorReporter |
getErrorReporter()
Get the ErrorReporter that is used to report errors in the user's input. |
double[] |
getLimits()
Get the values in the xmin, xmax, ymin, and ymax input boxes. |
java.awt.Dimension |
getPreferredSize()
Compute the preferred size of this panel. |
long |
getSerialNumber()
Part of the Tieable interface, and not meant to be called directly. |
boolean |
getUseTwoColumnsIfPossible()
Get the value of the "useTwoColumnsIfPossible" property of this panel. |
void |
notifyControllerOnChange(Controller c)
Method required by CheckInput interface. |
void |
paintComponent(java.awt.Graphics g)
Draw the input box labels. |
void |
processComponentEvent(java.awt.event.ComponentEvent evt)
Recompute component locations when the panel is resized. |
void |
setErrorReporter(ErrorReporter rep)
Set the ErrorReporter that is used to report errors in the user's input. |
void |
setForeground(java.awt.Color fg)
Overrides setForeground in order to set the foreground colors of all the contained buttons and fields. |
void |
setLimits(double[] limits)
Set the values in the xmin, xmax, ymin, and ymax input boxes. |
void |
setUseTwoColumnsIfPossible(boolean two)
Set to true if you want the components to be shown in two columns (provided the panel is wide enough). |
void |
sync(Tie t,
Tieable newest)
Part of the Tieable interface, and not meant to be called directly. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SET_LIMITS
public static final int EQUALIZE
public static final int ZOOM_IN
public static final int ZOOM_OUT
public static final int SAVE
public static final int RESTORE
public static final int ALL_BUTTONS
protected static final java.lang.String[] buttonNames
protected int buttons
protected boolean twoColumn
protected VariableInput xmin
protected VariableInput xmax
protected VariableInput ymin
protected VariableInput ymax
protected long serialNumber
protected Tie syncWith
protected ErrorReporter errorReporter
protected CoordinateRect coords
protected java.util.Vector items
protected java.util.Vector animatorItems
Constructor Detail |
---|
public LimitControlPanel()
public LimitControlPanel(int buttonsToAdd, boolean useTwoColumnsIfPossible)
buttonsToAdd
- The set of buttons to be added to the panel. Can consist of
one or more of the constants SET_LIMITS, EQUALIZE, ZOOM_IN,
ZOOM_OUT, SAVE, and RESTORE, or'ed together.useTwoColumnsIfPossible
- If this is true, then the components in the panel will be
arranged into two columns instead of one (assuming that there
is room).public LimitControlPanel(java.lang.String xminName, java.lang.String xmaxName, java.lang.String yminName, java.lang.String ymaxName, int buttonsToAdd, boolean useTwoColumnsIfPossible)
xminName
- Name to be used as a label for the xmin input box.xmaxName
- Name to be used as a label for the xmax input box.yminName
- Name to be used as a label for the ymin input box.ymaxName
- Name to be used as a label for the ymax input box.buttonsToAdd
- The set of buttons to be added to the panel. Can consist of
one or more of the constants SET_LIMITS, EQUALIZE, ZOOM_IN,
ZOOM_OUT, SAVE, and RESTORE, or'ed together.useTwoColumnsIfPossible
- If this is true, then the components in the panel will be
arranged into two columns instead of one (assuming that there
is room).Method Detail |
---|
public void addCoords(CoordinateRect coords)
coords
- the CoordinateRect to be controlledpublic void addCoords(DisplayCanvas canvas)
canvas
- the DisplayCanvas to get the CoordinateRect frompublic void setErrorReporter(ErrorReporter rep)
rep
- the error reporter to usepublic ErrorReporter getErrorReporter()
public void setUseTwoColumnsIfPossible(boolean two)
two
- true or falsepublic boolean getUseTwoColumnsIfPossible()
public void addAnimator(Animator animator)
animator
- public void addComponent(javax.swing.JComponent c)
c
- component to add to panelpublic void addComponentPair(javax.swing.JComponent c1, javax.swing.JComponent c2)
c1
- component to add to panelc2
- component to add to panelpublic void addRange(VariableInput v1, VariableInput v2)
v1
- VariableInput to add to panelv2
- VariableInput to add to panelpublic void addButtons(int buttonSet)
buttonSet
- buttons to add to panelprotected int getButtonOptions()
public javax.swing.JButton getButton(int buttonCode)
buttonCode
- one of the constants from this class (SET_LIMITS, EQUALIZE,
etc.) specifying one of the types of button for controlling
limits. If the parameter is not one of these constants, and
IllegalArgumentException will be thrown.
public javax.swing.JComponent add(javax.swing.JComponent c)
c
- component to add
public void notifyControllerOnChange(Controller c)
notifyControllerOnChange
in interface InputObject
c
- controller to notifypublic void checkInput()
checkInput
in interface InputObject
public long getSerialNumber()
getSerialNumber
in interface Tieable
public void sync(Tie t, Tieable newest)
sync
in interface Tieable
t
- tie to usenewest
- object to synch withpublic double[] getLimits()
getLimits
in interface Limits
public void setLimits(double[] limits)
setLimits
in interface Limits
limits
- array of limit valuespublic void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- event created when user clicks a buttonpublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- graphics contextpublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void processComponentEvent(java.awt.event.ComponentEvent evt)
processComponentEvent
in class java.awt.Component
evt
- event created when panel is resizedpublic void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
fg
- the foreground color to useJComponent.setForeground(java.awt.Color)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |