borland.jbcl Packages borland.jbcl Class Hierarchy borland.jbcl.control
java.lang.Object +----java.awt.Component +----java.awt.Container +----java.awt.Panel +----borland.jbcl.view.BeanPanel +----borland.jbcl.view.ButtonView +----borland.jbcl.control.ButtonControl
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();
}
}
public ButtonControl()Creates a button with default properties.
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. 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.
public String getImageName() public void setImageName(java.lang.String path)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.
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 synchronized void addComponentListener(java.awt.event.ComponentListener l) public synchronized void removeComponentListener(java.awt.event.ComponentListener l)
public synchronized void addContainerListener(java.awt.event.ContainerListener l) public void removeContainerListener(java.awt.event.ContainerListener l)
public synchronized void addFocusListener(java.awt.event.FocusListener l) public synchronized void removeFocusListener(java.awt.event.FocusListener l)
public synchronized void addKeyListener(java.awt.event.KeyListener l) public synchronized void removeKeyListener(java.awt.event.KeyListener l)
public void addModelListener(borland.jbcl.model.SingletonModelListener l) public void removeModelListener(borland.jbcl.model.SingletonModelListener l)
public synchronized void addMouseListener(java.awt.event.MouseListener l) public synchronized void removeMouseListener(java.awt.event.MouseListener l)
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener l) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener l)