borland Packages  Class Hierarchy  dbswing Package 

JdbCheckBox component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----javax.swing.JComponent
                           +----javax.swing.AbstractButton
                                   +----javax.swing.JToggleButton
                                           +----javax.swing.JCheckBox
                                                   +----com.borland.dbswing.JdbCheckBox

About the JdbCheckBox component

Variables  Constructors  Properties  Methods  Event Listeners

Implements DBDataBinder, ColumnAware, DataSetAware, ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

Note: This is a feature of JBuilder Professional and Enterprise.

The JdbCheckBox component extends the javax.swing.JCheckBox class. It adds the following properties:

JdbCheckBox sets its text, alignment, background, foreground, and font properties using the property settings from the Column specified with the columnName property, if they are defined, unless these properties are set explicitly on the JdbCheckBox itself. The value of the text property is considered to be its default state (not explicitly set) if text is null or an empty string ("").

Like JCheckBox, JdbCheckBox has constructors that set an initial value. This is seldom useful for a data-aware control. To set a JdbCheckBox to a default value for each new row of a DataSet, set the default property of the Column the check box is bound to.

selectedDataValue and unselectedDataValue properties

In the Inspector, at design-time, the selectedDataValue and unselectedDataValue property values are set as Strings, regardless of the data type of the Column. JBuilder converts the value to the proper data type if needed.

At runtime, these properties take on default values if they are not set. This is most useful when the component is bound to a boolean Column; then selectedDataValue defaults to true and unselectedDataValue defaults to false. When bound to a numeric Column, the defaults are 1 and 0; when bound to a String Column, the defaults are true and false.

For more information about these properties, see selectedDataValue and unselectedDataValue properties in DBButtonDataBinder.


JdbCheckBox variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in javax.swing.AbstractButton

Variables implemented in javax.swing.JComponent

JdbCheckBox constructors

JdbCheckBox properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

Properties implemented in javax.swing.AbstractButton

Properties implemented in javax.swing.JCheckBox

Properties implemented in javax.swing.JComponent

JdbCheckBox methods

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

Methods implemented in javax.swing.AbstractButton

Methods implemented in javax.swing.JCheckBox

Methods implemented in javax.swing.JComponent

JdbCheckBox event listeners


JdbCheckBox variables

dataBinder

  protected DBButtonDataBinder dataBinder
The DBButtonDataBinder that makes this a data-aware component.

JdbCheckBox constructors

JdbCheckBox()

  public JdbCheckBox()
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes default values of null, null, and false to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The check box resulting from this constructor has no text or icon and is initially unselected.

JdbCheckBox(java.lang.String)

  public JdbCheckBox(String text)
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes the specified text string, along with default values of null, and false to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The resulting check box has the specified text string displayed beside it. The check box is initially unselected.

Parameters:

text
The text string that displays next to the check box that identifies it.

JdbCheckBox(java.lang.String, boolean)

  public JdbCheckBox(String text, boolean selected)
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes the specified text string and selected parameter value, along with a default value of null for the Icon parameter, to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The resulting check box has the specified text string displayed beside it. The check box is initially selected if the selected parameter is true and is not initially selected if false.

Parameters:

text
The text string that displays next to the check box that identifies it.
selected
If true, the check box is checked; if false, the check box is not checked.

JdbCheckBox(java.lang.String, javax.swing.Icon)

  public JdbCheckBox(String text, Icon icon)
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes the specified text string and icon, along with a default boolean value of false, to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The resulting check box has the specified String and Icon displayed beside it. The check box is initially unselected.

Parameters:

text
The text string that displays next to the check box that identifies it.
icon
The icon that displays next to the check box.

JdbCheckBox(java.lang.String, javax.swing.Icon, boolean)

  public JdbCheckBox(String text, Icon icon, boolean selected)
Constructs a JdbCheckBox component by calling the constructor of its superclass that takes a String, an Icon, and a boolean as parameters. The String and Icon display beside the check box. The check box is initially selected if the selected parameter is true and is not initially selected if false.

This constructor is called by all of the other JdbCheckBox constructors, and is the only one of them that directly invokes a constructor of its superclass.

Parameters:

text
The text string that displays next to the check box that identifies it.
icon
The icon that displays next to the check box.
selected
If true, the check box is checked; if false, the check box is not checked.

JdbCheckBox(javax.swing.Icon)

  public JdbCheckBox(Icon icon)
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes the specified icon, along with default values of null for the String and false for the boolean, to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The resulting check box has the Icon displayed beside it. The check box is initially unselected.

Parameters:

icon
The icon that displays next to the check box.

JdbCheckBox(javax.swing.Icon, boolean)

  public JdbCheckBox(Icon icon, boolean selected)
Constructs a JdbCheckBox component by calling the constructor of this class which takes a String, an Icon, and a boolean as parameters. This constructor passes the specified icon and boolean, along with a default value of null for the String, to the other JdbCheckBox constructor. That constructor then calls the constructor of its superclass that also takes a String, an Icon, and a boolean as parameters.

The resulting check box has the Icon displayed beside it. The check box is initially selected if the selected parameter is true and is not initially selected if false.

Parameters:

icon
The icon that displays next to the check box.
selected
If true, the check box is checked; if false, the check box is not checked.

JdbCheckBox properties

columnName

 public String getColumnName()
 public void setColumnName(String columnName)
Specifies a Column name in the DataSet to display data from and write data to. Usually the data type for the value in the Column linked to a JdbCheckBox is boolean. Regardless of the type, the selectedDataValue and unselectedDataValue values are specified as Strings and JBuilder converts them to the appropriate data type.

Parameters: selectedDataValue, unselectedDataValue

dataSet

 public DataSet getDataSet()
 public void setDataSet(DataSet dataSet)
Specifies the DataSet that is the source of the data to display and to write to.

selectedDataValue

 public String getSelectedDataValue()
 public void setSelectedDataValue(String selectedValue)
Returns and sets the value written to the DataSet when the check box is checked. Setting this value to null results in nothing being written to the DataSet. Setting this value to an empty string ("") results in the DataSet value being cleared.

Note that regardless of the data type of the Column, the property value is set as a String. JBuilder converts it to the proper data type if needed.

textWithMnemonic

 public String getTextWithMnemonic()
 public void setTextWithMnemonic(String text)
textWithMnemonic is a convenience property for setting the check box's text, which interprets an ampersand character (&) within the text as an instruction to make the character following the ampersand the mnemonic character for the check box. To put an ampersand in the text but not make the character following it a hot key, put a backslash before the ampersand. To make a literal ampersand the hot key, put two consecutive ampersands in the text.

When the String entered is displayed in the Inspector and as the check box's text in design mode and at runtime, the ampersand is removed and the hot key character is underlined.

This property can be used instead of the usual text property, even if a mnemonic character is not embedded in the text. It is particularly useful for applications that resource strings for internationalization, because the text and mnemonic can be specified in a single string.

Note that the first occurrence of the mnemonic character is always denoted visibly as the mnemonic key, despite the location of the ampersand within the text. Furthermore, only the first occurrence of an ampersand is removed from the text.

When textWithMnemonic is set, both the text and textWithMnemonic properties are updated. If both the text and textWithMnemonic properties are set, the most recently set property takes precedence.

textWithMnemonic is a bound property, and therefore a property change event is fired when its value is modified.

unknownDataValueMode

 public int getUnknownDataValueMode()
 public void setUnknownDataValueMode(int mode)
Returns and sets the policy for setting check box state when synchronizing the check box with its DataSet value when the value doesn't match either of the selectedDataValue or unselectedDataValue property values. These are the values used for the mode parameter:

See also: DBButtonDataBinder

unselectedDataValue

 public String getUnselectedDataValue()
 public void setUnselectedDataValue(String unselectedValue)
Returns and sets the value written to the DataSet when the check box is unchecked. Setting this value to null results in nothing being written to the DataSet. Setting this value to an empty string ("") results in the DataSet value being cleared.

Note that regardless of the data type of the column, the property value is set as a String. JBuilder converts it to the proper data type if needed.


JdbCheckBox event listeners

This component is a source for the following event sets.

action

 public void addActionListener(java.awt.event.ActionListener )
 public void removeActionListener(java.awt.event.ActionListener )

ancestor

 public void addAncestorListener(javax.swing.event.AncestorListener )
 public void removeAncestorListener(javax.swing.event.AncestorListener )

change

 public void addChangeListener(javax.swing.event.ChangeListener )
 public void removeChangeListener(javax.swing.event.ChangeListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public synchronized void removeContainerListener(java.awt.event.ContainerListener )

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener )
 public synchronized void removeFocusListener(java.awt.event.FocusListener )

inputMethod

 public synchronized void addInputMethodListener(java.awt.event.InputMethodListener )
 public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )

item

 public void addItemListener(java.awt.event.ItemListener )
 public void removeItemListener(java.awt.event.ItemListener )

key

 public synchronized void addKeyListener(java.awt.event.KeyListener )
 public synchronized void removeKeyListener(java.awt.event.KeyListener )

mouse

 public synchronized void addMouseListener(java.awt.event.MouseListener )
 public synchronized void removeMouseListener(java.awt.event.MouseListener )

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener )
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )