borland Packages  Class Hierarchy  jbcl.control Package  Index 

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

Variables  Constructors  Properties  Methods  Event Listeners

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

A ButtonControl generates an action event when it is clicked. The button can display a text string or an image or both.

The text string is the value of the label property. To display an image, use the image, imageName, or imageURL properties. You can also set the image with the setImage() method. The value of the imageFirst and orientation properties determine how the image and label are arranged on the button if both are present.

ButtonControl inherits much of its behavior from ButtonView, such as whether the button is visible or enabled, the size of the margins around the text and image, the font used for the label, and so on. See ButtonView for all these properties and methods that ButtonControl inherits.

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 this class

Variables implemented in borland.jbcl.view.BeanPanel

Variables implemented in borland.jbcl.view.ButtonView

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

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 com.sun.java.swing.JComponent

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 com.sun.java.swing.JComponent

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

ButtonControl event listeners


ButtonControl variables

image

  protected transient Image image

imageFirst

  protected boolean imageFirst

imageName

  protected String imageName

label

  protected String label

orientation

  protected int orientation

textureName

  protected String textureName

url

  protected URL url

ButtonControl constructors

ButtonControl()

  public ButtonControl()

Creates a button.

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. If first is true, the image is placed on the top or left. If it is false, the image is placed on the bottom or right. Top and bottom applies apply to vertical orientation while left and right apply to horizontal orientation.

imageName

 public String getImageName()
 public void setImageName(java.lang.String name)

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.

textureName

 public String getTextureName()
 public void setTextureName(java.lang.String path)
Determines the name of the Image file that is tiled on the background of the control to give the appearance of texture. Specify the file name and directory using the path parameter.

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)

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 )