|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--dog.gui.DComponent | +--dog.gui.DCheckbox
A multiline checkbox component.
The checkbox can be in one of two states: on or off. The behaviour of checkboxes can be controlled by setting its group (a DCheckboxGroup manager). This handles the dependencies between a set of checkboxes and buttons. When a checkbox has a group, its indicator is drawn as a circle. Otherwise it is drawn as a square. User activity generates item events (a state change of 1 indicates that the checkbox is on, and 0 indicates that it is off).
You can specify a label and alignment for the button. The graphic indicator is displayed on the edge defined by the alignment, and the label is aligned against the inner edge of the indicator.
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected int |
align
The checkbox alignment. |
protected java.lang.String |
command
The command to send in action events. |
protected boolean |
down
Whether the checkbox is currently being pressed. |
protected boolean |
focus
|
protected DCheckboxGroup |
group
The checkbox group that controls this checkbox. |
protected java.lang.String |
label
The checkbox label. |
static int |
LEFT
The left alignment. |
static int |
RIGHT
The right alignment. |
protected boolean |
value
The value of the checkbox. |
Fields inherited from class dog.gui.DComponent |
CENTER, CENTER_TILE, changes, EAST, INTEGER_TILE, MAXIMIZE, MAXIMIZE_ASPECT, MAXIMIZE_HORIZONTAL, MAXIMIZE_VERTICAL, NORTH, NORTHEAST, NORTHWEST, reference, SOUTH, SOUTHEAST, SOUTHWEST, TILE, tooltip, 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 | |
DCheckbox()
Constructs a checkbox with no label. |
|
DCheckbox(boolean value)
Constructs a checkbox with no label and the specified value. |
|
DCheckbox(java.lang.String label)
Constructs a checkbox with the specified label. |
|
DCheckbox(java.lang.String label,
boolean value)
Constructs a checkbox with the specified label and value. |
|
DCheckbox(java.lang.String label,
boolean value,
DCheckboxGroup group)
Constructs a checkbox with the specified label, value, and group. |
|
DCheckbox(java.lang.String label,
DCheckboxGroup group)
Constructs a checkbox with the specified label and group. |
|
DCheckbox(java.lang.String label,
int align)
Constructs a checkbox with the specified label and alignment. |
|
DCheckbox(java.lang.String label,
int align,
boolean value)
Constructs a checkbox with the specified label, alignment, and value. |
|
DCheckbox(java.lang.String label,
int align,
boolean value,
DCheckboxGroup group)
Constructs a checkbox with the specified label, alignament, value, and group. |
|
DCheckbox(java.lang.String label,
int align,
DCheckboxGroup group)
Constructs a checkbox with the specified label, alignment, and group. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener to receive action events from this component. |
java.lang.String |
getActionCommand()
Returns this checkbox' action command. |
int |
getAlign()
Returns the alignment of the checkbox (LEFT or RIGHT). |
DCheckboxGroup |
getGroup()
Returns the group managing interdependencies between this checkbox and others. |
java.lang.String |
getLabel()
Returns the label. |
java.awt.Dimension |
getMinimumSize()
Returns the minimum size for this checkbox. |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size of this checkbox. |
java.lang.String |
getText()
This is an alias for getLabel(). |
boolean |
getValue()
Indicates whether the checkbox is on or off. |
boolean |
isFocusTraversable()
This component is focus-traversable if it is not disabled. |
void |
paint(java.awt.Graphics g)
Paints this checkbox. |
protected java.lang.String |
paramString()
Returns the parameter string for this component. |
protected void |
processActionEvent(java.awt.event.ActionEvent event)
Processes action events on this checkbox by dispatching them to any registered ActionListeners. |
protected void |
processEvent(java.awt.AWTEvent event)
Processes events on this checkbox. |
protected void |
processFocusEvent(java.awt.event.FocusEvent event)
Processes focus events on this checkbox by dispatching them to any registered FocusListener objects. |
protected void |
processKeyEvent(java.awt.event.KeyEvent event)
Processes mouse events on this checkbox by dispatching them to any registered MouseListener objects. |
protected void |
processMouseEvent(java.awt.event.MouseEvent event)
Processes mouse events on this checkbox by dispatching them to any registered MouseListener objects. |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent event)
Processes mouse motion events on this checkbox by dispatching them to any registered MouseMotionListener objects. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener so it no longer receives action events from this component. |
void |
setActionCommand(java.lang.String command)
Sets the action command. |
void |
setAlign(int align)
Sets the checkbox alignment. |
void |
setGroup(DCheckboxGroup group)
Sets the group managing interdependencies between this checkbox and others. |
void |
setLabel(java.lang.String label)
Sets the label. |
void |
setText(java.lang.String text)
This is an alias for setLabel(). |
void |
setValue(boolean value)
Sets the checkbox state. |
void |
update(java.awt.Graphics g)
Updates this checkbox's graphics context. |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int LEFT
public static final int RIGHT
protected boolean value
protected boolean down
protected java.lang.String label
protected int align
protected DCheckboxGroup group
protected java.lang.String command
protected transient boolean focus
Constructor Detail |
public DCheckbox()
public DCheckbox(java.lang.String label)
public DCheckbox(java.lang.String label, int align)
public DCheckbox(boolean value)
public DCheckbox(java.lang.String label, boolean value)
public DCheckbox(java.lang.String label, int align, boolean value)
public DCheckbox(java.lang.String label, int align, DCheckboxGroup group)
public DCheckbox(java.lang.String label, DCheckboxGroup group)
public DCheckbox(java.lang.String label, boolean value, DCheckboxGroup group)
public DCheckbox(java.lang.String label, int align, boolean value, DCheckboxGroup group)
Method Detail |
public boolean getValue()
setValue(boolean)
public void setValue(boolean value)
flag
- true if on, false if off.getValue()
public java.lang.String getText()
getLabel()
public void setText(java.lang.String text)
setLabel(java.lang.String)
public java.lang.String getLabel()
setLabel(java.lang.String)
public void setLabel(java.lang.String label)
label
- the label text.getLabel()
public int getAlign()
setAlign(int)
public void setAlign(int align)
align
- LEFT or RIGHT.getAlign()
public DCheckboxGroup getGroup()
setGroup(dog.gui.DCheckboxGroup)
public void setGroup(DCheckboxGroup group)
getGroup()
public java.lang.String getActionCommand()
setActionCommand(java.lang.String)
public void setActionCommand(java.lang.String command)
getActionCommand()
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Component
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public void update(java.awt.Graphics g)
update
in class java.awt.Component
public void paint(java.awt.Graphics g)
paint
in class java.awt.Component
ds
- the control dark shadow colour to useh
- the control highlight colour to usec
- the control colour to usepc
- the primary control colour to usepcds
- the primary control dark shadow colour to usef
- the colour to draw the dot inpublic boolean isFocusTraversable()
isFocusTraversable
in class java.awt.Component
public void addActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerprotected void processEvent(java.awt.AWTEvent event)
processEvent
in class DComponent
event
- the eventprotected void processActionEvent(java.awt.event.ActionEvent event)
event
- the action eventprotected void processFocusEvent(java.awt.event.FocusEvent event)
processFocusEvent
in class java.awt.Component
event
- the focus eventprotected void processKeyEvent(java.awt.event.KeyEvent event)
processKeyEvent
in class java.awt.Component
event
- the mouse eventprotected void processMouseEvent(java.awt.event.MouseEvent event)
processMouseEvent
in class DComponent
event
- the mouse eventprotected void processMouseMotionEvent(java.awt.event.MouseEvent event)
processMouseMotionEvent
in class DComponent
event
- the mouse motion eventprotected java.lang.String paramString()
paramString
in class DComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |