jbcl.view Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----com.borland.jbcl.view.BeanPanel +----com.borland.jbcl.view.ButtonView +----com.borland.jbcl.control.ButtonControl
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.
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.
protected int alignment
protected ButtonItemPainter borderPainter
Paints the border of a button.
protected Border dnBorder
protected Insets margins
protected boolean mouseDown
If true, indicates that the mouse button has been pressed, over the button, but not released.
protected boolean mouseOver
If true, indicates that the mouse cursor is
over the button.
protected int state
Stores whether the button is selected or disabled. Also stores whether the button currently has focus.
protected int state
protected Border upBorder
public ButtonView()
Constructs a ButtonView component with default property
values. Sets the button background color to SystemColor.control
.
public String getActionCommand() public void setActionCommand(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.
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.
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.
public boolean isFocusAware() public void setFocusAware(boolean aware)
Determines whether this button is able to accept input focus.
public Insets getItemMargins() public void setItemMargins(Insets margins)
Returns the margins around the text and image on the button.
public SingletonModel getModel() public void setModel(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
.
public Dimension getPreferredSize()
Returns the preferred size of the button, for controlling layout.
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.
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.
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.
public Component getSiteComponent()
Returns the ItemPaintSite
component.
public SingletonViewManager getViewManager() public void setViewManager(com.borland.jbcl.model.SingletonViewManager vm)
Determines the view manager object handling the viewer selection for this component.
public boolean isTransparent()Determines whether the view is transparent or opaque.
public SingletonViewManager getViewManager() public void setViewManager(SingletonViewManager vm)
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.
public WritableSingletonModel getWriteModel()
Returns null if the button is read-only, else returns the WritableSingletonModel for this button.
protected SingletonModel createDefaultModel()
protected SingletonViewManager createDefaultViewManager()
public void paintBorder(Graphics g)
Overrides: javax.swing.JComponent.paintBorder(java.awt.Graphics)
public void paintComponent(Graphics g)Paints or repaints the ButtonView component.
Parameters:
g
Graphics
object used for painting on.
Overrides: com.borland.jbcl.view.BeanPanel.paintComponent(java.awt.Graphics)
protected String paramString()
Returns the parameter string of the button.
Overrides: java.awt.Container.paramString()
protected void processFocusEvent(FocusEvent e)
If the button is focus-aware, repaints. Calls super.processFocusEvent(FocusEvent).
Parameters:
e
Overrides: com.borland.jbcl.view.BeanPanel.processFocusEvent(java.awt.event.FocusEvent)
protected void processKeyPressed(KeyEvent e)
Handles clicking the button when a keyboard shortcut is pressed.
Parameters:
e
Overrides: com.borland.jbcl.view.BeanPanel.processKeyPressed(java.awt.event.KeyEvent)
protected void processKeyReleased(KeyEvent e)
Handles the release of a key when a keyboard shortcut is used to click the button.
Parameters:
e
Overrides: com.borland.jbcl.view.BeanPanel.processKeyReleased(java.awt.event.KeyEvent)
protected void processMouseDragged(MouseEvent e)
Overrides: com.borland.jbcl.view.BeanPanel.processMouseDragged(java.awt.event.MouseEvent)
protected void processMouseEntered(MouseEvent e)
Called when the mouse cursor is over the button.
Parameters:
event
Overrides: com.borland.jbcl.view.BeanPanel.processMouseEntered(java.awt.event.MouseEvent)
protected void processMouseExited(MouseEvent e)
Called when the mouse cursor moves off of the button.
Parameters:
event
Overrides: com.borland.jbcl.view.BeanPanel.processMouseExited(java.awt.event.MouseEvent)
protected void processMousePressed(MouseEvent e)
Called when the mouse button is clicked over the button.
Parameters:
events
Overrides: com.borland.jbcl.view.BeanPanel.processMousePressed(java.awt.event.MouseEvent)
protected void processMouseReleased(MouseEvent e)
Called when the mouse button is released while the mouse cursor is over the button.
Parameters:
event
Overrides: com.borland.jbcl.view.BeanPanel.processMouseReleased(java.awt.event.MouseEvent)
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
y
width
height
Overrides: java.awt.Component.setBounds(int,int, int, int)
public void update(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
Overrides: java.awt.Component.update(java.awt.Graphics)
public void updateUI()
Overrides: javax.swing.JComponent.updateUI()
public synchronized void addActionListener(ActionListener l) public synchronized void removeActionListener(ActionListener l)
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
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 void addModelListener(SingletonModelListener l) public void removeModelListener(SingletonModelListener l)
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 )