![]() |
Overview |
The spinner suite of beans is a component with two small direction buttons that lets the user modify the value in an input field or possibly enter a new legal value directly in the input field.
The Spinner suite of beans consists of three beans according to their data types: the DigitalSpinner Bean, DateSpinner Bean and the TimeSpinner Bean.
This document is intended to be used by application builders who would like to build Java applications using the three kinds of spinners. The application developer is expected to be familiar with the Java language and the JavaBeans architecture. The developer should be familiar with building applications by linking beans in an application builder tool. Familiarity with the functionality of Spinner would be advantageous, though not mandatory if the developer does not intend to extend the functionality provided by the beans.
Conventions | Description | Example |
Text in italics | names of dialog boxes, figures, reference to chapters and other sections, task name etc. | Figure 1, Overview, etc. |
|
list of points |
|
Numbered list 1, 2, 3, .... | sequential steps |
|
Text in Bold and Italics | name of the file | Spinner.zip, readme.html |
Text in Courier font | names of classes, methods, events, part of code included in the document, etc. | ActionPerformed |
Image | Used to |
![]() |
navigate to the previous sub-heading |
![]() |
navigate to the previous main heading |
![]() |
return to the Table of Contents |
![]() |
represent a Note information |
Overview - introduces the user to the Spinner suite of beans. Provides information like intended audience, guide organization and copyrights
Component Description - describes the Spinner component in general. It gives list of beans in the suite and deployment scenarios
Installation Instructions - describes the hardware and software required for installing and using the Spinner suite of beans, and also describes how to install the beans and prepare them for use.
Usage Instructions - provides information on bean usage, wiring scenarios and serialization.
Alternating Wiring Scenarios - describes special wiring scenarios that may involve beans within and outside the component suite.
Individual Bean Documentation - provides links to individual bean documentation which describe each bean in the suite w.r.t. its events, properties methods etc.
User Interface - describes the various user interface components of the SMTP component..
Demo Application - describes the demo application and provides instructions on how to run the demo application.
References - provides links internet sites which give substantial reference documentation.
Glossary - gives a brief explanation of some of the technical terms used in the document.
Copyright © 1998 IBM Corp.
All rights reserved.
IBM and VisualAge are trademarks of International Business Machines in the United States and/or other countries.
* Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc, in the U.S. and other countries.
![]() |
Component Description |
The objective of the Spinner suite of beans is to provide diverse applications with the ability to modify the value in an input field or enter a legal value to the input field.
Based on the data types, the Spinner suite of beans internally consists of three beans :
These beans may be used together or separately.
The Spinner suite of beans consists of :
The Spinner suite of beans is to provide diverse applications with the ability to modify the value in an input field or enter a legal value to the input field. It consists of three types of spinners(DigitalSpinner,DateSpinner and TimeSpinner). Since they are standalone, there are no special deployment problems among them.
![]() |
Installation Instructions |
These JavaBeans are designed to be compliant with 100% Pure Java requirements, and will therefore execute on any hardware platform that supports the Java Environment.
43KB of disk space is required to install the Spinner Bean Jar files to VisualAge for Java and 52KB is required to install it to Visual Cafe. Additional hard disk space would be required to install the Java Development Kit, Bean Development Kit or any Java Application Builder Tool which may be used to build / compile applications using these beans.
The Spinner Beans are designed to work with Java Development Kit Version 1.1 and above.
These beans may be linked to each other and tested in the BeanBox testing tool from JavaSoft.
Any Java Application Builder (E.g. VisualAge for Java from IBM Corp, VisualCafé from Symantec Corp., Java Workshop from SunSoft) with JavaBeans support may be used to develop applications using these beans.
Note : Please refer to the User's Guide of your
IDE on how to import a bean into the IDE.
There are no platform specific issues for the Spinner suite of beans. Any operating system that supports Java canbe used.
![]() |
Usage Instructions |
The jar files of the Spinner suite of beans should be added to the jars directory of the beanbox. The wiring scenarios are described below.
Since the three beans are standalone, there is no special procedure involved in integrating all the beans in the suite.
The beans in the Spinner suite are serializable
![]() |
Alternate Wiring Scenarios |
This section explains the special wiring scenarios that may involve beans within and outside the component suite.
Wiring the Spinners would requires
the following events:
The fired ActionEvent would invoke the Actionistener's "actionPerformed"
method.
![]() |
Individual Bean Documentation |
![]() |
Reference to common properties |
![]() |
Reference to common methods |
---|
Decrements the current value of the spinner.
Returns:
null
Gets the current arrow style of the spinner.
Returns:
the current arrow style of the spinner.
Gets the background color of the input area.
Returns:
the input area background color.
public Color getDownArrowColor()
Gets the down arrow color.
Returns:
the down arrow color.
public Font getFont()
Gets the current edit font of the spinner.
Returns:
the current edit font of the spinner.
Gets the foreground color.
Returns:
the input area foreground color.
public Color getUpArrowColor()
Gets the up arrow color.
Returns:
the up arrow color.
public void increment()
Increments the spinner's current value.
Returns:
null
public boolean isEditable()
Gets the spinner's current editable status.
Returns:
the spinner current editable status.
Gets the enabled status of the spinner.
Returns:
the current enabled status of the spinner.
public void setArrowStyle(int style)
Sets the arrow style of the spinner.
Parameters:
style - the desired arrow style of the spinner.
public void setBackground(Color color)
Sets the background color of the input area.
Parameters:
color - the desired input area background color.
public void setDownArrowColor(Color arrow_color)
Sets the down arrow color.
Parameters:
arrow_color - the desired down arrow color.
public void setEditable(boolean edit_flag)
Sets the editable status of the spinner.
Parameters:
edit_flag - the desired editable status of the spinner.
public void setEnabled|(boolean flag)
Sets the enabled status of the spinner.
Parameters:
flag - the desired enabled status of the spinner.
public void setFont|(Font edit_font)
Sets the edit font of the spinner.
Parameters:
edit_font - the desired edit font of the spinner.
public void setForeground(Color color)
Sets the foreground color.
Parameters:
color - the desired input area foreground color.
public void setUpArrowColor(Color
arrow_color)
Sets the up arrow color.
Parameters:
arrow_color - the desired up arrow color.
![]() |
User Interface |
This section describes the user interface of the Spinner beans.
The Spinner Suite of beans consists of three
spinner beans, as shown in Figure 1.
Figure 1 - Main Screen
Following is the detailed explanation of the Spinner Main Screen components :
The Input Area of each Spinner is used to input data directly by users.
The Direction Buttons is used for users to increase/decrease the current value with predefined increment / decrement value.
![]() |
Demo Application |
The demo directory contains all the necessary
files for running the demo. This demo application demonstrates how the
Spinner suite of beans can be used.
To run the demo application provided with this package,
follow the steps given below :
WINDOWS CLASSPATH
After installing the software, update the CLASSPATH environment variable as follows :
Start the Control Panel, select System, then edit the CLASSPATH environment variable.
Set the CLASSPATH to point to
spinner\lib\spinner.jar
To change the CLASSPATH, open the AUTOEXEC.BAT file and make the change to the CLASSPATH statement. (Be sure to make a backup of the AUTOEXEC.BAT before making any changes).
Set the CLASSPATH to point to
spinner\lib\spinner.jar
For example if spinner is installed under C:\ then set CLASSPATH as (add the following line to the end of the AUTOEXEC.BAT file.)
CLASSPATH = %CLASSPATH%;C:\spinner\lib\spinner.jar
AIX CLASSPATH
After installing the software, update the CLASSPATH environment variable as follows :
Set the CLASSPATH to point to
spinner/lib/spinner.jar
For example if spinner is installed under the home directory then set CLASSPATH as - (add the following line to the end of the .profile file.)
export CLASSPATH = spinner/lib/spinner.jar :$CLASSPATH
OS/2 CLASSPATH
After installing the software, update the CLASSPATH environment variable as follows :
Set the CLASSPATH to point to
spinner\lib\spinner.jar
For example if spinner is installed under C:\ then set CLASSPATH as (append the following to the CLASSPATH environment variable of the CONFIG.SYS file.)
C:\spinner\lib\spinner.jar
The demo application illustrates a part of functionality of DigitalSpinner and how to using its firing events. When users change the value or increase/decrease the current value of the spinner, the label's size in the frame increases or decreases accordingly.
The source code is shown as below(Also in the Demo directory):
import com.ibm.spinner.DigitalSpinner;
import java.awt.Frame;
import java.awt.Label;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.AWTEvent;
import java.awt.event.WindowEvent;
import java.awt.Graphics;
public class SpinnerDemo extends
Frame implements ActionListener {
private DigitalSpinner num_spin = new DigitalSpinner();
private Label label = new Label();
public static void main(String argv[]) {
SpinnerDemo spins = new SpinnerDemo();
spins.setSize(200,200);
spins.setTitle("Spinner Demo");
spins.show();
}
public SpinnerDemo() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
setBackground(java.awt.Color.lightGray);
setLayout(null); add(num_spin);
num_spin.setBounds(30,30,50,20);
num_spin.addActionListener(this);
add(label);
label.setBounds(30,60,50,50);
label.setBackground(java.awt.Color.pink);
label.setText((new Integer(num_spin.getCurrent())).toString());
label.setAlignment(Label.CENTER);
}
public void paint(Graphics g) {
g.drawRect(label.getBounds().x - 1, label.getBounds().y - 1, label.getBounds().width
+ 1,label.getBounds().height + 1);
}
protected void processWindowEvent(WindowEvent we) {
if (we.getID() == WindowEvent.WINDOW_CLOSING) {
dispose();
System.exit(0);
}
super.processWindowEvent(we);
}
public void actionPerformed(ActionEvent act_evt) {
int num_cur = num_spin.getCurrent();
String act_str = act_evt.getActionCommand();
if (act_str.equals("increment")) {
label.setSize(label.getBounds().width + 1,label.getBounds().height + 1);
}
if (act_str.equals("decrement")) {
label.setSize(label.getBounds().width - 1,label.getBounds().height - 1);
}
label.setText((new Integer(num_cur)).toString()); repaint();
}
}
The Main Screen of the demo application is:
![]() |
References |
![]() |
Glossary of Terms |
This document is last updated in V1.0 on 04/02/1998