borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.control 

ButtonControl 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 ButtonControl component

Variables  Constructors  Properties  Methods  Event Listeners

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

Creates a graphical, clickable, data-aware button. A Button is labelled with a centered String. Generates an action event when pressed.

Example:


import borland.jbcl.control.*;
import java.awt.event.*;

public class ButtonTest extends DecoratedFrame implements ActionListener {
   ButtonControl testbutton = new ButtonControl("Click Me");

   ButtonTest() {
      super();
      setTitle("Button Test");
      add("Center", testbutton);
      testbutton.addActionListener(this);
      pack();
      show();
   }
    
   public void actionPerformed(ActionEvent evt){
         System.out.println("Clicked.");
   }

   static public void main(String[] args) {
      new ButtonTest();
   }
}


ButtonControl variables

Variables implemented in borland.jbcl.view.BeanPanel

Variables implemented in borland.jbcl.view.ButtonView

Variables implemented in java.awt.Component

ButtonControl constructors

ButtonControl properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.BeanPanel

Properties implemented in borland.jbcl.view.ButtonView

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

ButtonControl methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.BeanPanel

Methods implemented in borland.jbcl.view.ButtonView

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.Panel

Methods implemented in java.lang.Object

ButtonControl event listeners


ButtonControl constructors

ButtonControl()

  public ButtonControl()
Creates a button with default properties.

ButtonControl(java.awt.Image)

  public ButtonControl(java.awt.Image image)
Creates a button. The specified image is displayed on the button's surface.

Parameters:

image
The image to show on the button.

ButtonControl(java.lang.String)

  public ButtonControl(java.lang.String label)
Creates a button with the specified label in the middle of the button.

Parameters:

label
The label to show on the button.

ButtonControl(java.lang.String, java.awt.Image)

  public ButtonControl(java.lang.String label, java.awt.Image image)
Creates a button with the specified image and label.

Parameters:

label
The label to show on the button.
image
The image to show on the button.


ButtonControl properties

image

 public Image getImage()
 public void setImage(java.awt.Image image)
Stores the name or location of the image displayed on the button.

imageFirst

 public boolean isImageFirst()
 public void setImageFirst(boolean first)
Defines how the button label and image are arranged. true for placing the image on the top/left, or false for placing the image on the bottom/right. "top" applies to vertical orientation; "left" applies to horizontal orientation.

imageName

 public String getImageName()
 public void setImageName(java.lang.String path)
Stores the name of the image that appears on the button.

imageURL

 public URL getImageURL()
 public void setImageURL(java.net.URL url)
Stores the URL of the image to show on the button.

label

 public String getLabel()
 public void setLabel(java.lang.String l)
Stores the text shown on the face of the button.

orientation

 public int getOrientation()
 public void setOrientation(int o)
Defines how the button label and image are oriented. Can be Orientation.HORIZONTAL or Orientation.VERTICAL.


ButtonControl methods

setImage(java.awt.Image, java.lang.String)

  protected void setImage(java.awt.Image im, java.lang.String path)

Specifies the location of the image file to be displayed on the button.

Parameters:

im
The image file name.
path
The directory.


ButtonControl 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)