borland Packages  Class Hierarchy  jbcl.view Package  Index 

ButtonView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----borland.jbcl.view.BeanPanel
                                   +----borland.jbcl.view.ButtonView
                                           +----borland.jbcl.control.ButtonControl

About the ButtonView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements ItemPaintSite, SingletonModelListener, SingletonModelView, SingletonView, ImageObserver, MenuContainer, Serializable, EventListener

The ButtonView component provides much of the appearance and behavior of composite button controls that use it.

Buttons can be visible or hidden and they can be enabled or disabled. Use the visible property to determine whether the button is visible, and use the enabled property to determine whether the button is enabled.

Buttons usually have a label or image or both on them. The alignment property determines how the label or image is positioned within the button. If selected is true, the button appears as it is pressed. If showRollover is true, the button view is repainted when the mouse cursor moves over the button. If focusAware is true, the button can receive the focus.


ButtonView variables

Variables implemented in this class

Variables implemented in borland.jbcl.view.BeanPanel

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in java.awt.Component

ButtonView constructors

ButtonView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.BeanPanel

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

ButtonView methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.BeanPanel

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

ButtonView event listeners


ButtonView variables

actionCommand

  protected String actionCommand

The command name of the action event fired by this button. By default, this will be set to the label of the button.

alignment

  protected int alignment

borderPainter

  protected ButtonItemPainter borderPainter

Paints the border of a button.

dnBorder

  protected Border dnBorder

margins

  protected Insets margins

mouseDown

  protected boolean mouseDown

If true, indicates that the mouse button has been pressed, over the button, but not released.

mouseOver

  protected boolean mouseOver

If true, indicates that the mouse cursor is over the button.

state

  protected int state

Stores whether the button is selected or disabled. Also stores whether the button currently has focus.

state

  protected int state

upBorder

  protected Border upBorder

ButtonView constructors

ButtonView()

  public ButtonView()

Constructs a ButtonView component with default property values. Sets the button background color to SystemColor.control.


ButtonView properties

actionCommand

 public String getActionCommand()
 public void setActionCommand(java.lang.String command)

The command name of the action event fired by this button. By default this will be set to the label of the button.

alignment

 public int getAlignment()
 public void setAlignment(int alignment)

Determines the alignment of the text or image within the button. Valid values for the alignment parameter are one or a combination of the Alignment variables.

enabled

 public void setEnabled(boolean enable)

Enables or disables the button. If enable is true, the button is enabled. If enable is false, the button is disabled.

focusAware

 public boolean isFocusAware()
 public void setFocusAware(boolean aware)

Determines whether this button is able to accept input focus.

itemMargins

 public Insets getItemMargins()
 public void setItemMargins(java.awt.Insets margins)

Returns the margins around the text and image on the button.

model

 public SingletonModel getModel()
 public void setModel(borland.jbcl.model.SingletonModel sm)

To set the model: removes the model listener, changes the model to SingleonModel, and adds a model listener for the current viewer. Sets writeModel to WritableSingletonModel.

preferredSize

 public Dimension getPreferredSize()

Returns the preferred size of the button, for controlling layout.

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)

Determines whether the button label can be changed. If ro is true, the label can be changed; if ro is false, the label cannot be changed.

selected

 public boolean isSelected()
 public void setSelected(boolean selected)

Determines whether the button is selected. When selected is true, the button appears as it is pressed.

showRollover

 public boolean isShowRollover()
 public void setShowRollover(boolean showRollover)

The showRollover property enables/disables the repainting of the rollover state. When an item is in the rollover state, the mouse is floating over it. If an ItemPainter plugged into the field ignores the ROLLOVER bit, this property will have no effect. By default, showRollover is false.

siteComponent

 public Component getSiteComponent()

Returns the ItemPaintSite component.

viewManager

 public SingletonViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.SingletonViewManager vm)

Determines the view manager object handling the viewer selection for this component.

transparent

 public boolean isTransparent()
Determines whether the view is transparent or opaque.

viewManager

 public SingletonViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.SingletonViewManager vm)

visible

 public void setVisible(boolean visible)

Determines whether the button is visible. If visible is true, the button is visible; if visible is false, the button is hidden.

writeModel

 public WritableSingletonModel getWriteModel()

Returns null if the button is read-only, else returns the WritableSingletonModel for this button.


ButtonView methods

createDefaultModel()

  protected SingletonModel createDefaultModel()

createDefaultViewManager()

  protected SingletonViewManager createDefaultViewManager()

paintBorder(java.awt.Graphics)

  public void paintBorder(java.awt.Graphics g)

Overrides: com.sun.java.swing.JComponent.paintBorder(java.awt.Graphics)

paintComponent(java.awt.Graphics)

  public void paintComponent(java.awt.Graphics g)
Paints or repaints the ButtonView component.

Parameters:

g
The Graphics object used for painting on.

Overrides: borland.jbcl.view.BeanPanel.paintComponent(java.awt.Graphics)

paramString()

  protected String paramString()

Returns the parameter string of the button.

Overrides: java.awt.Container.paramString()

processFocusEvent(java.awt.event.FocusEvent)

  protected void processFocusEvent(java.awt.event.FocusEvent e)

If the button is focus-aware, repaints. Calls super.processFocusEvent(FocusEvent).

Parameters:

e
The focus event for the button.

Overrides: borland.jbcl.view.BeanPanel.processFocusEvent(java.awt.event.FocusEvent)

processKeyPressed(java.awt.event.KeyEvent)

  protected void processKeyPressed(java.awt.event.KeyEvent e)

Handles clicking the button when a keyboard shortcut is pressed.

Parameters:

e
The key event for the button.

Overrides: borland.jbcl.view.BeanPanel.processKeyPressed(java.awt.event.KeyEvent)

processKeyReleased(java.awt.event.KeyEvent)

  protected void processKeyReleased(java.awt.event.KeyEvent e)

Handles the release of a key when a keyboard shortcut is used to click the button.

Parameters:

e
The key event for the button.

Overrides: borland.jbcl.view.BeanPanel.processKeyReleased(java.awt.event.KeyEvent)

processMouseDragged(java.awt.event.MouseEvent)

  protected void processMouseDragged(java.awt.event.MouseEvent event)

Overrides: borland.jbcl.view.BeanPanel.processMouseDragged(java.awt.event.MouseEvent)

processMouseEntered(java.awt.event.MouseEvent)

  protected void processMouseEntered(java.awt.event.MouseEvent event)

Called when the mouse cursor is over the button.

Parameters:

event
The mouse event.

Overrides: borland.jbcl.view.BeanPanel.processMouseEntered(java.awt.event.MouseEvent)

processMouseExited(java.awt.event.MouseEvent)

  protected void processMouseExited(java.awt.event.MouseEvent event)

Called when the mouse cursor moves off of the button.

Parameters:

event
The mouse event.

Overrides: borland.jbcl.view.BeanPanel.processMouseExited(java.awt.event.MouseEvent)

processMousePressed(java.awt.event.MouseEvent)

  protected void processMousePressed(java.awt.event.MouseEvent event)

Called when the mouse button is clicked over the button.

Parameters:

events
The mouse event.

Overrides: borland.jbcl.view.BeanPanel.processMousePressed(java.awt.event.MouseEvent)

processMouseReleased(java.awt.event.MouseEvent)

  protected void processMouseReleased(java.awt.event.MouseEvent event)

Called when the mouse button is released while the mouse cursor is over the button.

Parameters:

event
The mouse event.

Overrides: borland.jbcl.view.BeanPanel.processMouseReleased(java.awt.event.MouseEvent)

setBounds(int, int, int, int)

  public void setBounds(int x, int y, int width, int height)

Calls super.setBounds(x, y, width, height), then adds a delay to make navigator buttons repaint properly after a resize.

Parameters:

x
The distance between the container and the left side of the button.
y
The distance between the container and the top of the button.
width
The width of the button, in pixels.
height
The height of the button, in pixels.

Overrides: java.awt.Component.setBounds(int,int, int, int)

update(java.awt.Graphics)

  public void update(java.awt.Graphics g)

Paints or repaints the button to the screen. This method is called in response to a call to repaint. By default, the background is not cleared, avoiding flicker.

Parameters:

g
The graphics context object passed in to be painted.

Overrides: java.awt.Component.update(java.awt.Graphics)

updateUI()

  public void updateUI()

Overrides: com.sun.java.swing.JComponent.updateUI()


ButtonView event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

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

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

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 void removeContainerListener(java.awt.event.ContainerListener )

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener )
 public synchronized void removeFocusListener(java.awt.event.FocusListener )

key

 public synchronized void addKeyListener(java.awt.event.KeyListener )
 public synchronized void removeKeyListener(java.awt.event.KeyListener )

model

 public void addModelListener(borland.jbcl.model.SingletonModelListener l)
 public void removeModelListener(borland.jbcl.model.SingletonModelListener l)

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 )