borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.JLabel +----com.borland.dbswing.JdbLabel
Variables Constructors Properties Methods Event Listeners
Implements ColumnAware, DataSetAware, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
The JdbLabel
component extends the javax.swing.JLabel
class. It adds the following properties:
dataSet
- The DataSet
from which the text
property of the label is assigned.
columnName
- The Column
of the DataSet
from which the text
property of the label is assigned.
columnNameIcon
- The Column
of the DataSet
from which the icon
property of the label is assigned.
iconEditable
- Whether icons can be loaded from files at runtime by double-clicking the label.
textWithMnemonic
- Allows text and a mnemonic character to be set simultaneously from a single string.
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
.
DBLabelDataBinder
protected DBLabelDataBinder dataBinderThe
DBButtonDataBinder
that makes this a data-aware component.
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.
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.
text
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.
text
horizontalAlignment
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.
text
icon
Icon
displayed as part of the label.
horizontalAlignment
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.
icon
Icon
displayed as the label.
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.
icon
Icon
displayed as the label.
horizontalAlignment
public String getColumnName() public void setColumnName(String columnName)Stores the name of the
DataSet
Column
from which the JdbLabel
displays data.
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.
columnName
, 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.
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.
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.
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )