borland Packages  Class Hierarchy  dbswing Package 

JdbRadioButton component

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

About the JdbRadioButton component

Variables  Constructors  Properties  Methods  Event Listeners

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

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

The JdbRadioButton component extends the javax.swing.JRadioButton class. It adds the following properties:

JdbRadioButton 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 JdbRadioButton 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 JRadioButton, JdbRadioButton has constructors that set an initial value. This is seldom useful for a data-aware control. To set a JdbRadioButton to a default value for each new row of a DataSet, set the default property of the Column the radio button 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.

The values of the selectedDataValue and unselectedDataValue properties must be consistent with the display mask of the bound-to column. This usually isn't an issue because this component is seldom bound to real number or date/time columns, which are the ones that benefit most from custom formatting. However, if you do specify a display mask for a column bound to one of these components, it's important to be aware of this rule.

Usually there is no need to set the unselectedDataValue property for a JdbRadioButton. If you set the radio button's buttonGroup property, the ButtonGroup ensures that only one button in the set is selected. The unselected button has no need to write to the DataSet. Instead the newly selected button writes its selectedDataValue to the DataSet.

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


JdbRadioButton variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in javax.swing.AbstractButton

Variables implemented in javax.swing.JComponent

JdbRadioButton constructors

JdbRadioButton 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.JComponent

Properties implemented in javax.swing.JRadioButton

JdbRadioButton 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.JComponent

Methods implemented in javax.swing.JRadioButton

JdbRadioButton event listeners


JdbRadioButton variables

dataBinder

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

JdbRadioButton constructors

JdbRadioButton()

  public JdbRadioButton()
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. Default values of null, null, and false are passed to the other constructor. The radio button displays no text or icon and is initially selected.

JdbRadioButton(java.lang.String)

  public JdbRadioButton(String text)
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. The specified text string, along with default values of null and false, are passed to the other constructor. The String displays beside the radio button. The radio button is initially unselected.

Parameters:

text
The text string that appears next to and identifies the button.

JdbRadioButton(java.lang.String, boolean)

  public JdbRadioButton(String text, boolean selected)
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. The specified text string and boolean value, along with a default value of null for the icon, are passed to the other constructor. The String displays beside the radio button. The radio button is initially selected if the selected parameter is true and is not initially selected if false.

Parameters:

text
The text string that appears next to and identifies the button.
selected
If true, the button is selected; otherwise, it is unselected.

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

  public JdbRadioButton(String text, Icon icon)
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. The specified text string and icon are passed to the other constructor, along with a default value of false. The Icon replaces the radio button image and the String displays beside it. The radio button is initially unselected.

Parameters:

text
The text string that appears next to and identifies the button.
icon
The image that replaces the radio button.

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

  public JdbRadioButton(String text, Icon icon, boolean selected)
Constructs a JdbRadioButton component by calling the constructor of its superclass that takes a String, an Icon, and a boolean as parameters. The Icon replaces the radio button image and the String displays beside it. The radio button 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 JdbRadioButton constructors. It is the only one of them that calls a constructor of its superclass directly.

Parameters:

text
The text string that appears next to and identifies the button.
icon
The image that replaces the radio button image.
selected
If true, the button is selected; otherwise, it is unselected.

JdbRadioButton(javax.swing.Icon)

  public JdbRadioButton(Icon icon)
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. The specified icon is passed to the other constructor, along with default values of null for the text string and false for the boolean value. The Icon replaces the radio button image. The radio button is initially unselected.

Parameters:

icon
The image that replaces the radio button image.

JdbRadioButton(javax.swing.Icon, boolean)

  public JdbRadioButton(Icon icon, boolean selected)
Constructs a JdbRadioButton component by calling the constructor of this class that takes a String, an Icon, and a boolean. The specified icon and boolean value are passed to the other constructor, along with a default value of null for the text string. The Icon replaces the radio button image. The radio button is initially selected if the selected parameter is true and is not initially selected if false.

Parameters:

icon
The image that replaces the radio button image.
selected
If true, the button is selected; otherwise, it is unselected.

JdbRadioButton properties

buttonGroup

 public ButtonGroup getButtonGroup()
 public void setButtonGroup(ButtonGroup buttonGroup)
Returns and sets the ButtonGroup to which this button belongs.

To set a buttonGroup for JdbRadioButton, use the Bean Chooser tool to select the Swing javax.swing.ButtonGroup component and drop it on to the UI designer. Then assign this component as the value of the buttonGroup property. For example:

    jdbRadioButton1.setButtonGroup(buttonGroup1);

columnName

 public String getColumnName()
 public void setColumnName(String columnName)
Returns and sets a column name in the DataSet to display data from and to write data to. Usually the data type for the value in the column linked to a JdbRadioButton is short, int, or a String. Regardless of the type, the selectedDataValue and unselectedDataValue values are specified as Strings and JBuilder converts them to the appropriate data type.

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 to be written to the DataSet when the button is selected. 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 button'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 button. 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 radio button'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.

unselectedDataValue

 public String getUnselectedDataValue()
 public void setUnselectedDataValue(String unselectedValue)
Returns the value written to the DataSet when the button is unselected and sets the value to be written to the DataSet when the button is unselected. 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.


JdbRadioButton 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 )