borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.JLabel +----com.borland.dbswing.JdbStatusLabel
Variables Constructors Properties Methods Event Listeners
Implements AccessListener, DataChangeListener, NavigationListener, StatusListener, FocusListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, SwingConstants
JdbStatusLabel
is a visible, non-editable component that displays
DataSet
status and validation messages, such as "Record 1 of 20" or
"Value entered is greater than the maximum allowed". A single JdbStatusLabel
can be used to
display messages from several DataSet
s (though only one at any
given time).
There are three ways to set up a JdbStatusLabel
for use in your
application:
JdbStatusLabel
as a visual component in a frame. By default,
JdbStatusLabel
identifies other data-aware components in the
same root container (for example, JFrame
), and displays messages generated
by the DataSet
of the component that currently has focus. This behavior is controlled by the autoDetect
property.
Note that autoDetect
doesn't detect components added after JdbStatusLabel
has been realized. If your application adds data-aware
components dynamically, and you want JdbStatusLabel
to display
messages from those newly added components, you must set
autoDetect
to true
after adding a new component to your container.
Set the dataSet
property to a specific
DataSet
if you always want JdbStatusLabel
to be associated with
that DataSet
only.
Pass an array of data-aware components to
the dataSetAwareComponents
property to explicitly identify
which data-aware components' DataSet
s should be monitored for
messages. This is useful if your application
dynamically adds and removes components from containers at runtime. The dataSetAwareComponents
property cannot be set through the Inspector.
If autoDetect
mode is used and there is only one DataSet
detected,
JdbStatusLabel
automatically attaches itself to that DataSet
.
Otherwise, to avoid any ambiguity, JdbStatusLabel
waits until a
component associated with a DataSet
is focused, and then attaches
itself to that DataSet
. In this case, the initial message
displayed by JdbStatusLabel
can be configured in one of two ways:
text
property. This message will be overwritten by the
next DataSet
status message.
The focusedDataSet
property can be set to a DataSet
whose status should be displayed, provided the text
property is blank (""). If neither the text
property nor the focusedDataSet
property are
set, initially JdbStatusLabel
displays a blank message.
JdbStatusLabel
updates its current DataSet
message
source when focusGained
events occur. Therefore, when focus moves from
a data-aware component to a non-data-aware component, the message
area is not cleared.
The displayMessages
property controls whether messages caused by DataSet
actions are displayed by
JdbStatusLabel
. Setting this property to false
allows background changes to be made to DataSet
s without the corresponding status
messages being displayed.
JdbStatusLabel
Depending upon the layout you use, you might need to set
JdbStatusLabel
's preferredSize
property to have
it appear correctly when it is initially displayed (especially if
it has blank text).
You can use the setText()
method to display a message at any
time in JdbStatusLabel
's text area. The message is overwritten, however,
the next time a DataSet
status event occurs. To prevent the message from being overwritten, set the displayMessages
property to false
until you want the message to be overwritten.
Call repaint()
to refresh the most recently displayed status
message.
public JdbStatusLabel()Constructs a
JdbStatusLabel
component by calling the null
constructor of its superclass.
public boolean isAutoDetect() public void setAutoDetect(boolean autoDetect)Returns and sets whether
JdbStatusLabel
automatically attaches itself to DataSet
s within its enclosing highest-level container (usually a JFrame
). The default value is true
, but the value changes to false
if you set the dataSet
property. Auto-detection occurs when the JdbStatusLabel
is realized. Setting autoDetect
to false
after the component is realized sets the currently defined array of data-aware components (to which JdbStatusLabel
listens for events) to those specified by the dataSetAwareComponents
property. Setting the dataSetAwareComponents
property to a non-null value changes the value of autoDetect
to false
. Setting autoDetect
to true
, clears the dataSetAwareComponents
and the dataSet
property values.
public DataSet getDataSet() public void setDataSet(DataSet dataSet)Returns and sets the
DataSet
that is the source of the status messages displayed by this component. Setting this property to a non-null value disables the autoDetect
property, and specifying a null
value automatically enables the autoDetect
property. When both the dataSet
and dataSetAwareComponents
properties are set, the one set most recently is the one that takes precedence and the setting of the other one is cleared.
public Component[] getDataSetAwareComponents() public void setDataSetAwareComponents(Component[] dataAwareComponents)Returns and sets the list of data-aware components to which
JdbStatusLabel
listens for DataSet
status messages. Setting this property to a non-null value disables the autoDetect
property, and specifying a null
value automatically enables the autoDetect
property. When both the dataSet
and dataSetAwareComponents
properties are set, the one set most recently is the one that takes precedence and the setting of the other one is cleared.
autoDetect
, DataSet
public boolean isDisplayMessages() public void setDisplayMessages(boolean displayMessages)Returns and sets whether messages are displayed. This property can be set to
false
to hide messages from the user. This is most useful when you want to temporarily hide messages from the user, or want to display a message of your own without having it overwritten by DataSet
status messages. Set displayMessages
back to true
when you no longer need to hide the status messages.
public DataSet getFocusedDataSet() public void setFocusedDataSet(DataSet dataSet)Returns and sets the
DataSet
from which the current status text is obtained. This property can also be used to specify which DataSet
's status should be displayed initially. To do so, set this property to that DataSet
, and leave the text
property blank ("").
Messages from the specified DataSet
continue to be displayed until another data-aware component receives focus, at which time messages from its DataSet
begin displaying.
This is not a bound property and does not fire a property change event.
public void addNotify()
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 final void addStatusLabelListener(StatusLabelListener listener) public final void removeStatusLabelListener(StatusLabelListener listener)
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )