borland Packages  Class Hierarchy  dbswing Package 

JdbTextField component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----javax.swing.JComponent
                           +----javax.swing.text.JTextComponent
                                   +----javax.swing.JTextField
                                           +----com.borland.dbswing.JdbTextField

About the JdbTextField component

Variables  Constructors  Properties  Methods  Event Listeners

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

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

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:

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:

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.

See also: DBTextDataBinder
Working with text in the dbswing package file.


JdbTextField variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in javax.swing.JComponent

Variables implemented in javax.swing.JTextField

Variables implemented in javax.swing.text.JTextComponent

JdbTextField constructors

JdbTextField 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.JTextField

Properties implemented in javax.swing.text.JTextComponent

JdbTextField methods

Methods implemented in this class

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.JTextField

Methods implemented in javax.swing.text.JTextComponent

JdbTextField event listeners


JdbTextField variables

dataBinder

  protected DBTextDataBinder dataBinder
The JdbTextDataBinder that makes JdbTextField a data-aware component.

JdbTextField constructors

JdbTextField()

  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.

JdbTextField(int)

  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.

Parameters:

columns
The number of visible character columns wide you want the text field to be.

JdbTextField(java.lang.String)

  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.

Parameters:

text
The text you want to appear initially in the text field.

JdbTextField(java.lang.String, int)

  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.

Parameters:

text
The text you want to appear initially in the text field.
columns
The number of visible character columns wide you want the text field to be.

JdbTextField(javax.swing.text.Document, java.lang.String, int)

  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.

Parameters:

doc
The text storage model to use.
text
The text you want to appear initially in the text field.
columns
The number of visible character columns wide you want the text field to be.

JdbTextField properties

columnName

 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.

dataSet

 public DataSet getDataSet()
 public void setDataSet(DataSet dataSet)
Returns and sets the DataSet from which values are read and to which values are written.

enableClearAll

 public boolean isEnableClearAll()
 public void setEnableClearAll(boolean enableClearAll)
Returns and sets whether the Clear All popup menu command appears.

See also: enablePopupMenu

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.

enableUndoRedo

 public boolean isEnableUndoRedo()
 public void setEnableUndoRedo(boolean enableUndoRedo)
Returns and sets whether the Undo and Redo menu commands appear on the popup menu.

See also: enablePopupMenu

nextFocusOnEnter

 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.

postOnFocusLost

 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.

postOnRowPosted

 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.

JdbTextField methods

commonInit()

  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.


JdbTextField event listeners

This component is a source for the following event sets.

action

 public synchronized void addActionListener(java.awt.event.ActionListener )
 public synchronized void removeActionListener(java.awt.event.ActionListener )

ancestor

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

caret

 public void addCaretListener(javax.swing.event.CaretListener )
 public void removeCaretListener(javax.swing.event.CaretListener )

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 )