borland Packages  Class Hierarchy  dbswing Package 

JdbLabel component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----javax.swing.JComponent
                           +----javax.swing.JLabel
                                   +----com.borland.dbswing.JdbLabel

About the JdbLabel component

Variables  Constructors  Properties  Methods  Event Listeners

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

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

The JdbLabel component extends the javax.swing.JLabel class. It adds the following properties:

columnNameIcon must be of data type Variant.INPUTSTREAM (for example, a .gif or .jpg file) or Variant.OBJECT (for example, a java.awt.Image or javax.swing.Icon).

Note that textWithMnemonic sets the display mnemonic only. To activate the mnemonic, use the setLabelFor() method to specify the component that should receive focus when the mnemonic key is pressed.

JdbLabel binds its alignment, background, foreground, and font properties from those defined on the Column columnName unless these same properties are already set explicitly on JdbLabel.

See also: DBLabelDataBinder


JdbLabel variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in javax.swing.JComponent

Variables implemented in javax.swing.JLabel

JdbLabel constructors

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

Properties implemented in javax.swing.JLabel

JdbLabel methods

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

Methods implemented in javax.swing.JComponent

Methods implemented in javax.swing.JLabel

JdbLabel event listeners


JdbLabel variables

dataBinder

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

JdbLabel constructors

JdbLabel()

  public JdbLabel()
Constructs a JdbLabel component by calling the constructor of this class which takes a String, an Icon, and an int. It passes default values of "" (an empty string), null, and SwingConstants.LEFT to that constructor.

JdbLabel(java.lang.String)

  public JdbLabel(String text)
Constructs a JdbLabel component that displays the specified text by calling the constructor of this class that takes a String, an Icon, and an int as its parameters. It passes the specified text string, along with default values of null, and SwingConstants.LEFT to that constructor.

Parameters:

text
The text string that appears as the label.

JdbLabel(java.lang.String, int)

  public JdbLabel(String text, int horizontalAlignment)
Constructs a JdbLabel component that displays the specified text using the specified alignment, by calling the constructor of this class that takes a String, an Icon, and an int as its parameters. It passes the specified text and alignment, along with a default value of null for the icon, to that constructor.

Parameters:

text
The text string that appears as the label.
horizontalAlignment
How the text is aligned horizontally. Choose one of these values: SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT.

JdbLabel(java.lang.String, javax.swing.Icon, int)

  public JdbLabel(String text, Icon icon, int horizontalAlignment)
Constructs a JdbLabel component that displays the specified text and icon in the specified alignment, by calling the constructor of its superclass that takes all three values as parameters.

This constructor is called by all of the other JdbLabel constructors. This is the only JdbLabel constructor which directly calls a constructor of its superclass.

Parameters:

text
The text string that appears as the label.
icon
The Icon displayed as part of the label.
horizontalAlignment
How the text is aligned horizontally. Choose one of these values: SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT.

JdbLabel(javax.swing.Icon)

  public JdbLabel(Icon image)
Constructs a JdbLabel component that displays the specified icon, by calling the constructor of this class that takes a String, an Icon, and an int as parameters. It passes the specified icon, along with default values of null for the text string and SwingConstants.CENTER for the alignment, to that constructor.

Parameters:

icon
The Icon displayed as the label.

JdbLabel(javax.swing.Icon, int)

  public JdbLabel(Icon image, int horizontalAlignment)
Constructs a JdbLabel component that displays the specified icon using the specified alignment, by calling the constructor of this class that takes a String, an Icon, and an int as parameters. It passes a default value of null for the text string, along with the specified icon and alignment, to that constructor.

Parameters:

icon
The Icon displayed as the label.
horizontalAlignment
How the label is aligned horizontally. Choose one of these values: SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT.

JdbLabel properties

columnName

 public String getColumnName()
 public void setColumnName(String columnName)
Stores the name of the DataSet Column from which the JdbLabel displays data.

columnNameIcon

 public String getColumnNameIcon()
 public void setColumnNameIcon(String columnNameIcon)
Returns and sets the column name of the DataSet from which the label's icon is read and to which the icon is written.

See also: columnName, DataSet

dataSet

 public DataSet getDataSet()
 public void setDataSet(DataSet dataSet)
Specifies the DataSet from which the data is read and to which the data is written.

iconEditable

 public boolean isIconEditable()
 public void setIconEditable(boolean iconEditable)
Returns and sets whether the label's icon can be changed at runtime. If iconEditable is true, double-clicking on the label displays a dialog box prompting the user to select an image file from which to set the icon. If a valid image file is selected, the label's icon is updated and saved to the DataSet column, if assigned. The default value is false.

Note that setting the icon directly using setIcon() does not save the icon to the DataSet. Use DataSet's setObject() or setInputStream() methods to save an icon programmatically to a DataSet column.

textWithMnemonic

 public String getTextWithMnemonic()
 public void setTextWithMnemonic(String text)
Returns and sets the text with an embedded mnemonic character. 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 label. To put an ampersand in the text but not make the character following it a hot key, put a back slash 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 label'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 textWithMnemonic sets the display mnemonic only. To activate the mnemonic, use the setLabelFor() method to specify the component that should receive focus when the mnemonic key is pressed.

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.


JdbLabel event listeners

This component is a source for the following event sets.

ancestor

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

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 )

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 )