borland Packages Class Hierarchy jbcl.control Package Index
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
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();
}
}
protected transient Image image
protected boolean imageFirst
protected String imageName
protected String label
protected int orientation
protected String textureName
protected URL url
public ButtonControl()
Creates a button.
public ButtonControl(java.awt.Image image)
Creates a button. The specified image is displayed on the button's surface.
Parameters:
public ButtonControl(java.lang.String label)
Creates a button with the specified label in the middle of the button.
Parameters:
public ButtonControl(java.lang.String label, java.awt.Image image)
Creates a button with the specified image and label.
Parameters:
public Image getImage() public void setImage(java.awt.Image image)
Stores the name or location of the image displayed on the button.
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.
public String getImageName() public void setImageName(java.lang.String name)
Stores the name of the image that appears on the button.
public URL getImageURL() public void setImageURL(java.net.URL url)
Stores the URL of the image to show on the button.
public String getLabel() public void setLabel(java.lang.String l)
Stores the text shown on the face of the button.
public int getOrientation() public void setOrientation(int o)
Defines how the button label and image are oriented. Can be Orientation.HORIZONTAL or Orientation.VERTICAL.
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.
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:
public synchronized void addActionListener(java.awt.event.ActionListener l) public synchronized void removeActionListener(java.awt.event.ActionListener l)
public void addAncestorListener(com.sun.java.swing.event.AncestorListener ) public void removeAncestorListener(com.sun.java.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 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 addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public void addModelListener(borland.jbcl.model.SingletonModelListener l) public void removeModelListener(borland.jbcl.model.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 )