| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.AbstractButton
|
+--javax.swing.JToggleButton
|
+--javax.swing.JCheckBox
|
+--com.togethersoft.openapi.util.ui.ThreeStateCheckBox
Three state check box class implements a checkbox with additional "third" state. This
class may become handy when it is needed to reflect the fact that a checkbox neither in
its selected no unselected state. This usualy happen when common properties of several
elements are displayed.
When the checkbox in its "third" state its icon is drawn differently compared to
the "normal". The class allows one to select the way it should draw the checkbox in the
third state via two methods:
- setCheckType(int chekType)
chekType can be eather:
ThreeStateChechBox.NORMAL_CHECK_TYPE to represent ordinary chek
ThreeStateChechBox.QUESTION_CHECK_TYPE to draw a question mark
- setCheckColor( Color checkColor ) to change the color of the third-state check
ThreeStateCheckBox class can be set to its third state after constuction time via
setUndefinedState() method:
ThreeStateChechBox tscb = new ThreeStateChechBox("test checkBox");
tscb.setUndefinedState();
The third state is not set by default.
| Inner Class Summary | |
private class | ThreeStateCheckBox.ThreeStateCheckboxIcon Class used for painting chekbox icons in different states |
private class | ThreeStateCheckBox.ThreeStateCheckBoxUI ThreeStateCheckBox UI delegate class |
| Field Summary | |
protected Color | checkColorConstant used to keep the third state check color - MetalLookAndFeel.getControlShadow() by default |
protected int | checkTypeConstant used to keep the third state check shape - NORMAL_CHECK_TYPE by default |
protected boolean | isUndefinedStateConstant used to track whether check box is in its undefined state (it is more efficient to maintain such a constant than to change default model) |
final static int | NORMAL_CHECK_TYPEConstant used to specify the ordinary check shape for the checkbox in its third state. |
final static int | QUESTION_CHECK_TYPEConstant used to specify the question mark check shape for the checkbox in its third state. |
| Fields inherited from class javax.swing.JCheckBox |
BORDER_PAINTED_FLAT_CHANGED_PROPERTY |
| Fields inherited from class javax.swing.AbstractButton |
MODEL_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, MARGIN_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, BORDER_PAINTED_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, CONTENT_AREA_FILLED_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, model, changeListener, actionListener, itemListener, changeEvent |
| Fields inherited from class javax.swing.JComponent |
ui, listenerList, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, accessibleContext |
| Fields inherited from class java.awt.Component |
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT |
| Constructor Summary | |
ThreeStateCheckBox(String text)Creates an initially unselected checkbox with text in its normal state (not in its third state). | |
ThreeStateCheckBox(String text, boolean isUndefined)Creates a checkbox with text in the third state | |
ThreeStateCheckBox(String text, boolean isUndefined, int checkType)Creates a checkbox with text in the third state with specified check type. | |
ThreeStateCheckBox(String text, boolean isUndefined, int checkType, Color checkColor)Creates a checkbox with text in the third state with specified check type and color | |
| Method Summary | |
Color | getCheckColor()Returns third state check color |
int | getCheckType()Returns checkbox third state check type |
boolean | isUndefinedState()Returnes boolean property to decide whether the checkbox is in undefined state or not |
protected void | removeUndefinedState()Removes undefined state of the check box. |
void | setCheckColor(Color checkColor)Sets checkbox third state check color. |
void | setCheckType(int checkType)Sets a check shape which will be drawn when the checkbox in its third (undefined) state. |
void | setSelected(boolean value)The method is very usefull if you create static instance of the class. |
void | setUndefinedState()Sets checkbox to its third (undefined) state |
| Methods inherited from class javax.swing.JCheckBox |
setBorderPaintedFlat, isBorderPaintedFlat, updateUI, getUIClassID, configurePropertiesFromAction, createActionPropertyChangeListener, paramString, getAccessibleContext |
| Methods inherited from class javax.swing.AbstractButton |
getText, setText, isSelected, doClick, doClick, setMargin, getMargin, getIcon, setIcon, getPressedIcon, setPressedIcon, getSelectedIcon, setSelectedIcon, getRolloverIcon, setRolloverIcon, getRolloverSelectedIcon, setRolloverSelectedIcon, getDisabledIcon, setDisabledIcon, getDisabledSelectedIcon, setDisabledSelectedIcon, getVerticalAlignment, setVerticalAlignment, getHorizontalAlignment, setHorizontalAlignment, getVerticalTextPosition, setVerticalTextPosition, getHorizontalTextPosition, setHorizontalTextPosition, checkHorizontalKey, checkVerticalKey, setActionCommand, getActionCommand, setAction, getAction, isBorderPainted, setBorderPainted, paintBorder, isFocusPainted, setFocusPainted, isContentAreaFilled, setContentAreaFilled, isRolloverEnabled, setRolloverEnabled, getMnemonic, setMnemonic, setMnemonic, isFocusTraversable, getModel, setModel, getUI, setUI, addChangeListener, removeChangeListener, fireStateChanged, addActionListener, removeActionListener, createChangeListener, fireActionPerformed, fireItemStateChanged, createActionListener, createItemListener, setEnabled, getLabel, setLabel, addItemListener, removeItemListener, getSelectedObjects, init, imageUpdate |
| Methods inherited from class javax.swing.JComponent |
setUI, getComponentGraphics, paintComponent, paintChildren, update, paint, printAll, print, printComponent, printChildren, printBorder, isPaintingTile, isFocusCycleRoot, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, requestFocus, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setPreferredSize, getPreferredSize, setMaximumSize, getMaximumSize, setMinimumSize, getMinimumSize, isMinimumSizeSet, isPreferredSizeSet, isMaximumSizeSet, contains, setBorder, getBorder, getInsets, getInsets, getAlignmentY, setAlignmentY, getAlignmentX, setAlignmentX, setInputVerifier, getInputVerifier, getGraphics, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, setVisible, hide, setForeground, setBackground, setFont, processFocusEvent, processComponentKeyEvent, processKeyEvent, processKeyBinding, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, processMouseMotionEvent, enable, disable, getClientProperty, putClientProperty, isLightweightComponent, reshape, getBounds, getSize, getLocation, getX, getY, getWidth, getHeight, hasFocus, isOpaque, setOpaque, computeVisibleRect, getVisibleRect, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, fireVetoableChange, addVetoableChangeListener, removeVetoableChangeListener, getTopLevelAncestor, addAncestorListener, removeAncestorListener, getListeners, addNotify, removeNotify, repaint, repaint, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, isDoubleBuffered, getRootPane |
| Methods inherited from class java.awt.Container |
getComponentCount, countComponents, getComponent, getComponents, insets, add, add, add, add, add, addImpl, remove, remove, removeAll, getLayout, setLayout, doLayout, layout, invalidate, validate, validateTree, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, processEvent, processContainerEvent, deliverEvent, getComponentAt, locate, getComponentAt, findComponentAt, findComponentAt, isAncestorOf, list, list |
| Methods inherited from class java.awt.Component |
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getGraphicsConfiguration, getTreeLock, getToolkit, isValid, isDisplayable, isVisible, isShowing, isEnabled, enable, enableInputMethods, show, show, getForeground, getBackground, getFont, getLocale, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, setBounds, isLightweight, getFontMetrics, setCursor, getCursor, paintAll, repaint, repaint, repaint, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, inside, contains, dispatchEvent, postEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getInputMethodRequests, getInputContext, enableEvents, disableEvents, coalesceEvents, processComponentEvent, processMouseEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, gotFocus, lostFocus, transferFocus, nextFocus, add, remove, toString, list, list, list, setComponentOrientation, getComponentOrientation |
| Methods inherited from class java.lang.Object |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize |
| Field Detail |
protected Color checkColor
protected int checkType
protected boolean isUndefinedState
public final static int NORMAL_CHECK_TYPE
public final static int QUESTION_CHECK_TYPE
| Constructor Detail |
public ThreeStateCheckBox(String text)
public ThreeStateCheckBox(String text, boolean isUndefined)
public ThreeStateCheckBox(String text, boolean isUndefined, int checkType)
public ThreeStateCheckBox(String text, boolean isUndefined, int checkType, Color checkColor)
| Method Detail |
public Color getCheckColor()
public int getCheckType()
public boolean isUndefinedState()
protected void removeUndefinedState()
public void setCheckColor(Color checkColor)
public void setCheckType(int checkType)
public void setSelected(boolean value)
public void setUndefinedState()
| Association Links |
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||