borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.AbstractButton +----javax.swing.JButton +----com.borland.dbswing.RepeatButton
Variables Constructors Properties Methods Event Listeners
Implements ActionListener, FocusListener, ImageObserver, ItemSelectable, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, SwingConstants
RepeatButton
is a fully-interchangeable subclass of JButton
. It adds the following properties:
defaultButton
- Makes this button the enclosing window's default button.textWithMnemonic
- Allows text and a mnemonic character to be set simultaneously from a single string.repeat
- Allows ActionEvents
to be fired repeatedly when the button is held down.repeatDelay
- The delay in milliseconds between repeated ActionEvents
.initialDelay
- The initial delay in milliseconds before the first repeated ActionEvent
occurs.public RepeatButton()Constructs a
RepeatButton
with no specified text or icon. Calls the constructor of this
class that takes a String
and an Icon
as parameters. Passes null
and null
to the other constructor.
public RepeatButton(String text)Constructs a
RepeatButton
with a specified text string that appears on the button face. Calls the constructor of this
class that takes a String
and an Icon
as parameters. Passes text
and null
to the other constructor.
text
public RepeatButton(String text, Icon icon)Constructs a
RepeatButton
with a specified text string and icon that appears on the button face. Calls the constructor of its superclass that takes a String
and an Icon
as parameters.
text
icon
public RepeatButton(Icon icon)Constructs a
RepeatButton
with a specified icon that appears on the button face. Calls the constructor of this
class that takes a String
and an Icon
as parameters. Passes null
and icon
to the other constructor.
icon
public void setDefaultButton(boolean defaultButton)Returns and sets whether this button should be its container's default button. Note that there can only be one default button within a window. If more than one button in the same container has this property set to
true
, the button which was most recently set to be the default button takes precedence. Also, note that default button behavior is look-and-feel dependent.
Because default button behavior is implemented by a JRootPane
object, this property is useful only when a RepeatButton
is placed within a Swing container with a JRootPane
(for example, JFrame
).
defaultButton
is a bound property, and therefore fires a property change event when modified.
Setting this property to true
has the side effect of setting the defaultCapable
property to true
if it is false
.
Note that the while the setter or write access method for defaultButton
is in RepeatButton
, the getter or read access method is in its parent, JButton
; defaultButton
is both a read and write property.
public int getInitialDelay() public void setInitialDelay(int initialDelay)Returns and sets the interval, in milliseconds, after which repeated
ActionEvents
are fired. The default initial delay is 400 milliseconds. initialDelay
is a bound property, and therefore it fires a property change event when its value is modified.
To have initialDelay
take effect, the repeat
property value must be true
.
repeat
, repeatDelay
public boolean isRepeat() public void setRepeat(boolean repeat)Returns and sets whether
ActionEvents
are fired repeatedly when the button is held down. This property is false
by default. repeat
is a bound property, and therefore it fires a property change event when its value is modified.
repeatDelay
public int getRepeatDelay() public void setRepeatDelay(int repeatDelay)Returns and sets the interval, in milliseconds, at which repeated
ActionEvents
are fired. The default interval is 200 milliseconds. repeatDelay
is a bound property, and therefore it fires a property change event when its value is modified.
To have repeatDelay
take effect, the repeat
property value must be true
.
repeat
, initialDelay
public String getTextWithMnemonic() public void setTextWithMnemonic(String text)
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 button. To put an ampersand in the text but not make the character following it a hot key, put a backslash 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 button'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 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 addNotify()Sets this button as the default button when the button's peer is created.
protected void processMouseEvent(MouseEvent e)
public void addActionListener(java.awt.event.ActionListener ) public void removeActionListener(java.awt.event.ActionListener )
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public void addChangeListener(javax.swing.event.ChangeListener ) public void removeChangeListener(javax.swing.event.ChangeListener )
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 void addItemListener(java.awt.event.ItemListener ) public void removeItemListener(java.awt.event.ItemListener )
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 )