| java.lang.Object thinwire.ui.AbstractComponent thinwire.ui.AbstractRangeComponent thinwire.ui.Slider
Slider | public class Slider extends AbstractRangeComponent (Code) | | A Slider is a screen element that has a cursor that can be set to any position between zero and a specified length.
Sliders are either horizontal or vertical depending on their dimensions. If the width is greater than the height,
then the Slider is horizontal, otherwise it is vertical.
Example:
Frame f = Application.current().getFrame();
f.setTitle("Slider Test");
Dialog d = new Dialog("Slider Test");
d.setBounds(10, 10, 250, 150);
final Slider s = new Slider(5, 3);
s.setBounds(10, 10, 100, 20);
s.addPropertyChangeListener(Slider.PROPERTY_CURRENT_INDEX, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent ev) {
tf.setText(String.valueOf((Integer) ev.getNewValue()));
}
});
d.getChildren().add(s);
final TextField tf = new TextField();
tf.setBounds(10, 40, 50, 20);
tf.setText(String.valueOf(s.getCurrentIndex()));
d.getChildren().add(tf);
Button b = new Button("SetValue");
b.setBounds(70, 35, 60, 30);
b.addActionListener(Button.ACTION_CLICK, new ActionListener() {
public void actionPerformed(ActionEvent ev) {
s.setCurrentIndex(Integer.parseInt(tf.getText()));
}
});
d.getChildren().add(b);
f.getChildren().add(d);
Keyboard Navigation:
KEY |
RESPONSE |
NOTE |
Right Arrow |
Increments the cursorIndex by 1 and Fires PropertyChangeEvent( propertyName = Slider.PROPERTY_CURSOR_INDEX ) |
Only if the component is horizontal. |
Left Arrow |
Decrements the cursorIndex by 1 and Fires PropertyChangeEvent( propertyName = Slider.PROPERTY_CURSOR_INDEX ) |
Only if the component is horizontal. |
Up Arrow |
Increments the cursorIndex by 1 and Fires PropertyChangeEvent( propertyName = Slider.PROPERTY_CURSOR_INDEX ) |
Only if the component is vertical. |
Down Arrow |
Decrements the cursorIndex by 1 and Fires PropertyChangeEvent( propertyName = Slider.PROPERTY_CURSOR_INDEX ) |
Only if the component is vertical. |
author: Ted C. Howard |
Constructor Summary | |
public | Slider() Constructs a new Slider with a length of 100 and initial currentIndex of 0. | public | Slider(int length) Constructs a new Slider with the specified length and an initial currentIndex of 0. | public | Slider(int length, int currentIndex) Constructs a new Slider with the specifed length and initial currentIndex. |
Slider | public Slider()(Code) | | Constructs a new Slider with a length of 100 and initial currentIndex of 0.
|
Slider | public Slider(int length)(Code) | | Constructs a new Slider with the specified length and an initial currentIndex of 0.
Parameters: length - the number of increments on the Slider |
Slider | public Slider(int length, int currentIndex)(Code) | | Constructs a new Slider with the specifed length and initial currentIndex.
Parameters: length - the number of increments on the Slider Parameters: currentIndex - the initial position of the cursor |
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)
|
|
|