borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.view 

ButtonView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.Panel
                           +----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, SingletonView, MenuContainer, ImageObserver, Serializable, EventListener

The ButtonView component is a button view element for developing new layered components. It requires a SingletonDataSetManager data provider and a SingletonViewManager view manager.


ButtonView variables

Variables implemented in this class

Variables implemented in borland.jbcl.view.BeanPanel

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 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 java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.Panel

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.

borderPainter

  protected ButtonItemPainter borderPainter
Paints the border of a button.

mouseDown

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

state

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


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()
No-op. Returns 0.

enabled

 public void setEnabled(boolean enable)
Enables the button.

focusAware

 public boolean isFocusAware()
 public void setFocusAware(boolean aware)
Determines whether this button is able to accept input focus.

itemMargins

 public Insets getItemMargins()
Returns the insets of the button.

label

 public String getLabel()
 public void setLabel(java.lang.String label)
Stores the text that appears 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)
Whether the button label can be changed.

selected

 public boolean isSelected()
 public void setSelected(boolean selected)
Stores whether the button has been pressed. Supports exclusive-selection for sticky buttons.

viewManager

 public SingletonViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.SingletonViewManager vm)
Determines the view manager object handling the viewer selection for this component.

visible

 public void setVisible(boolean visible)
Sets to not selected, and calls java.awt.Component.setVisible(visible).

writeModel

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


ButtonView methods

paint(java.awt.Graphics)

  public void paint(java.awt.Graphics g)
Paints or repaints the button.

Parameters:

g
The graphics context object to be painted.

Overrides: java.awt.Container.paint(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.ViewPanel.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.ViewPanel.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.ViewPanel.processKeyReleased(java.awt.event.KeyEvent)

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.ViewPanel.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.ViewPanel.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.ViewPanel.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.ViewPanel.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(Graphics)


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)

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener l)
 public synchronized void removeComponentListener(java.awt.event.ComponentListener l)

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener l)

focus

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

key

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

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 l)
 public synchronized void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener l)