borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.text.JTextComponent +----javax.swing.JTextField +----com.borland.dbswing.JdbTextField
Variables Constructors Properties Methods Event Listeners
Implements ColumnAware, DataSetAware, ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants
JdbTextField
is a data-aware extension of the JTextField
component.
Although data in a JdbTextField
is always edited as a String
, a
JdbTextField
can be used to display and edit data from all DataSet
data types except for BLOB/INPUTSTREAM-like types.
JdbTextField
also provides a right-click/Shift+F10 menu for
performing simple editing tasks, such as cutting, copying, or pasting clipboard data. Some of the menu's behavior can be customized via property settings:
enablePopupMenu
- Sets whether or not the popup menu is displayable.enableClearAll
- Sets whether the Clear All popup menu selection appears.enableUndoRedo
- Sets whether the Undo and Redo popup menu selections appear.
To make a JdbTextField
data-aware, set its dataSet
and columnName
properties. Note that the JdbTextField
's menu is available regardless of whether it is attached to a DataSet
or not.
Data typed into a JdbTextField
is not saved immediately to
the DataSet
. Rather, certain conditions or events automatically
cause the data to be put into the DataSet
's Column
. The two
properties which influence this behavior are these:
postOnFocusLost
- If true
, data is saved to the DataSet
whenever the JdbTextField
loses focus.
postOnRowPosted
- If true
, data is saved to the DataSet
whenever the current DataSet
row is posted.
When a JdbTextField
is attached to a DataSet
, the following
keystrokes perform special tasks when pressed:
JdbTextField
keystrokes
Keystroke(s) | Action |
---|---|
Enter | Causes the data in the field to be written to the DataSet Column . In general, changes to the field's text are not saved to the DataSet Column until some action that posts the field occurs. |
Esc | Makes the data in the field change back to the value in the DataSet Column . Pressing Esc discards any Undo/Redo information that has been accumulated. |
PgUp, PgDn | Moves to the previous and next DataSet row, respectively. If the postOnRowPosted property is true , pressing the PgUp or PgDn key saves all the text in the JdbTextField to the DataSet . |
Tab, Shift+Tab | Using either of these keystrokes to move to another component saves the current text to the DataSet if the postOnFocusLost property is true . More generally, if the postOnFocusLost property is true , any action that causes the JdbTextField to lose focus causes the text to be saved in the Column . |
DBTextDataBinder
Working with text in the dbswing
package file.
protected DBTextDataBinder dataBinderThe
JdbTextDataBinder
that makes JdbTextField
a data-aware component.
public JdbTextField()Constructs a
JdbTextField
component by calling the constructor of this
class that takes a Document
, a String
, and an int
as parameters. Passes default values of null
, null
, and 0 to that constructor.
public JdbTextField(int columns)Constructs a
JdbTextField
component by calling the constructor of this
class that takes a Document
, a String
, and an int
as parameters. Passes the specified number of columns, along with default null
values for the Document
and String
to the other constructor.
Note that the columns
parameter is not related to the rows and columns of a DataSet
, and is only a request for the desired width of the control. Depending on the font you use, you may see many more characters in the control than the value of columns
leads you to expect. Text in a JdbTextField
can scroll, so you can type in more characters than are visible.
Not all layouts will respect this requested width. FlowLayout
will, for example, but BorderLayout
won't. XYLayout
will as long as you don't resize the control.
columns
public JdbTextField(String text)Constructs a
JdbTextField
component by calling the constructor of this
class that takes a Document
, a String
, and an int
as parameters. Passes the specified text string, along with default values of null
for the Document
and 0 for the columns
parameter, to the other constructor.
text
public JdbTextField(String text, int columns)Constructs a
JdbTextField
component by calling the constructor of this
class that takes a Document
, a String
, and an int
as parameters. Passes the specified text string and number of columns, along with a default null
Document
, to the other constructor.
Note that the columns
parameter is not related to the rows and columns of a DataSet
, and is only a request for the desired width of the control. Depending on the font you use, you may see many more characters in the control than the value of columns
leads you to expect. Text in a JdbTextField
can scroll, so you can type in more characters than are visible.
Not all layouts will respect this requested width. FlowLayout
will, for example, but BorderLayout
won't. XYLayout
will as long as you don't resize the control.
text
columns
public JdbTextField(Document doc, String text, int columns)Constructs a
JdbTextField
component that uses the specified Document
, text string, and number of columns. Calls the constructor of its superclass that takes these three parameters. This constructor is called by all of the other JdbTextField
constructors, and is the only one of them that calls a constructor of its superclass directly.
Note that the columns
parameter is not related to the rows and columns of a DataSet
, and is only a request for the desired width of the control. Depending on the font you use, you may see many more characters in the control than the value of columns
leads you to expect. Text in a JdbTextField
can scroll, so you can type in more characters than are visible.
Not all layouts will respect this requested width. FlowLayout
will, for example, but BorderLayout
won't. XYLayout
will as long as you don't resize the control.
doc
text
columns
public String getColumnName() public void setColumnName(String columnName)Returns and sets the column name of the
DataSet
from which values are read and to which values are written.
public DataSet getDataSet() public void setDataSet(DataSet dataSet)Returns and sets the
DataSet
from which values are read and to which values are written.
public boolean isEnableClearAll() public void setEnableClearAll(boolean enableClearAll)Returns and sets whether the Clear All popup menu command appears.
enablePopupMenu
public boolean isEnablePopupMenu() public void setEnablePopupMenu(boolean popupEnabled)Returns and sets whether a popup menu appears when the user right-clicks the text field or presses Shift+F10.
public boolean isEnableUndoRedo() public void setEnableUndoRedo(boolean enableUndoRedo)Returns and sets whether the Undo and Redo menu commands appear on the popup menu.
enablePopupMenu
public boolean isNextFocusOnEnter() public void setNextFocusOnEnter(boolean nextFocusOnEnter)Returns and sets whether pressing Enter automatically moves focus to the next focusable field. The default value is
true
.
public boolean isPostOnFocusLost() public void setPostOnFocusLost(boolean postOnFocusLost)Returns and sets whether the current text is entered in the
DataSet
's Column
when focus is lost on the text field. The default value is true
.
public boolean isPostOnRowPosted() public void setPostOnRowPosted(boolean postOnRowPosted)Returns and sets whether the current text should be put in the
DataSet
's Column
when the current row is posted. This occurs, for example, if the user presses a row navigation key while the text component has current focus. The default value is true
.
protected void commonInit()Used to initialize
JdbTextField
with the same defaults, regardless of the constructor used.
A newly instantiated JdbTextField
differs from a JTextField
in that it has a non-blinking cursor, and slightly larger left and right margins.
public synchronized void addActionListener(java.awt.event.ActionListener ) public synchronized void removeActionListener(java.awt.event.ActionListener )
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public void addCaretListener(javax.swing.event.CaretListener ) public void removeCaretListener(javax.swing.event.CaretListener )
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 )