| java.lang.Object thinwire.ui.AbstractComponent thinwire.ui.AbstractTextComponent thinwire.ui.Button
Button | public class Button extends AbstractTextComponent implements ImageComponent(Code) | | A Button is a component that typically causes an action when activated.
Example:
Button b = new Button("Click Me!");
b.setBounds(20, 20, 150, 30);
b.addActionListener(Button.ACTION_CLICK, new ActionListener() {
public void actionPerformed(ActionEvent e) {
((Button) e.getSource()).setText("You Clicked Me!");
}
});
Dialog d = new Dialog("Button Test");
d.setBounds(20, 20, 200, 100);
d.getChildren().add(b);
d.setVisible(true);
Keyboard Navigation:
KEY |
RESPONSE |
NOTE |
Space |
Fires ActionEvent( action = Button.ACTION_CLICK ) |
Only if the component has focus. |
Enter |
Fires ActionEvent( action = Button.ACTION_CLICK ) |
Only if the 'standard' property is set to 'true' and ANY component in the Window has focus. The only exception is if you are
focused on a component that has it's own behavior for for the Enter key, in which case Ctrl-Enter may be used. |
Ctrl-Enter |
Fires ActionEvent( action=Button.ACTION_CLICK ) |
Only if the 'standard' property is set to 'true' and ANY component in the Window has focus. |
author: Joshua J. Gertzen |
Constructor Summary | |
public | Button() Constructs a new Button with no text or image. | public | Button(String text) Constructs a new Button with the specified text and no image. | public | Button(String text, String image) Constructs a new Button with the specified text and image. |
Method Summary | |
public String | getImage() | public ImageInfo | getImageInfo() | final public boolean | isStandard() Returns whether the button is the standard button (i.e. | public void | setImage(String image) | final public void | setStandard(boolean standard) Sets whether this button is the standard button.
There can only be a single standard button per Window ,
therefore setting this property to true will result in
the 'standard' property of the current standard button to be set to false. |
PROPERTY_STANDARD | final public static String PROPERTY_STANDARD(Code) | | |
Button | public Button()(Code) | | Constructs a new Button with no text or image.
|
Button | public Button(String text)(Code) | | Constructs a new Button with the specified text and no image.
Parameters: text - the text to display on the Button. |
Button | public Button(String text, String image)(Code) | | Constructs a new Button with the specified text and image.
Parameters: text - the text to display on the Button. Parameters: image - the name of a image file resource to display on the Button. |
isStandard | final public boolean isStandard()(Code) | | Returns whether the button is the standard button (i.e. default).
true if this button is the standard button |
setStandard | final public void setStandard(boolean standard)(Code) | | Sets whether this button is the standard button.
There can only be a single standard button per Window ,
therefore setting this property to true will result in
the 'standard' property of the current standard button to be set to false.
Parameters: standard - true to make this the standard button, false otherwise. throws: UnsupportedOperationException - if this Button's parent is not a Container. |
Methods inherited from thinwire.ui.AbstractComponent | public void addActionListener(String action, ActionListener listener)(Code)(Java Doc) public void addActionListener(String[] actions, ActionListener listener)(Code)(Java Doc) public void addDropListener(Component dragComponent, DropListener listener)(Code)(Java Doc) public void addDropListener(Component[] dragComponents, DropListener listener)(Code)(Java Doc) public void addKeyPressListener(String keyPressCombo, KeyPressListener listener)(Code)(Java Doc) public void addKeyPressListener(String[] keyPressCombos, KeyPressListener listener)(Code)(Java Doc) public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc) public void addPropertyChangeListener(String[] propertyNames, PropertyChangeListener listener)(Code)(Java Doc) public void fireAction(ActionEvent ev)(Code)(Java Doc) public void fireAction(String action)(Code)(Java Doc) public void fireAction(String action, Object source)(Code)(Java Doc) public void fireDrop(DropEvent ev)(Code)(Java Doc) public void fireDrop(Component dragComponent)(Code)(Java Doc) public void fireDrop(Component dragComponent, Object dragObject)(Code)(Java Doc) public void fireKeyPress(KeyPressEvent ev)(Code)(Java Doc) public void fireKeyPress(String keyPressCombo)(Code)(Java Doc) final protected boolean firePropertyChange(Object source, String propertyName, int oldValue, int newValue)(Code)(Java Doc) final protected boolean firePropertyChange(Object source, String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) final protected boolean firePropertyChange(Object source, String propertyName, Object oldValue, Object newValue)(Code)(Java Doc) public Container getContainer()(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public Label getLabel()(Code)(Java Doc) public Object getLimit()(Code)(Java Doc) public Object getParent()(Code)(Java Doc) String getStandardPropertyUnsupportedMsg(String propertyName, boolean read)(Code)(Java Doc) public Style getStyle()(Code)(Java Doc) public Object getUserObject()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public boolean isEnabled()(Code)(Java Doc) final public boolean isFocus()(Code)(Java Doc) public boolean isFocusCapable()(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) public void removeActionListener(ActionListener listener)(Code)(Java Doc) public void removeDropListener(DropListener listener)(Code)(Java Doc) public void removeKeyPressListener(KeyPressListener listener)(Code)(Java Doc) public void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc) public Component setBounds(int x, int y, int width, int height)(Code)(Java Doc) public void setEnabled(boolean enabled)(Code)(Java Doc) public void setFocus(boolean focus)(Code)(Java Doc) public void setFocusCapable(boolean focusCapable)(Code)(Java Doc) public void setHeight(int height)(Code)(Java Doc) void setLabel(Label label)(Code)(Java Doc) public Component setLimit(Object limit)(Code)(Java Doc) void setParent(Object parent)(Code)(Java Doc) public Component setPosition(int x, int y)(Code)(Java Doc) void setRenderer(Renderer r)(Code)(Java Doc) public Component setSize(int width, int height)(Code)(Java Doc) public void setUserObject(Object userObject)(Code)(Java Doc) public void setVisible(boolean visible)(Code)(Java Doc) public void setWidth(int width)(Code)(Java Doc) public void setX(int x)(Code)(Java Doc) public void setY(int y)(Code)(Java Doc)
|
|
|