CheckBox component in Echo3
Some of the very useful components that are common in any application development are CheckBox, ListBox, Button and RadioButton. Here in this Check Box example we will describe you how to create CheckBox component in Echo3. We have used here the server-side API to create checkbox. CheckBox class can be found in the nextapp.echo.app package.
There are four constructor of the class CheckBox as follows:
- CheckBox() default constructor, will create a simple checkbox without any label
- CheckBox(ImageReference icon) will creates a check box with an icon
- CheckBox(java.lang.String text) will creates a check box with label
- CheckBox(java.lang.String text, ImageReference icon) it will creates a check box with label and an icon
To create CheckBox application in Echo3 we have created two java files as described below:
- CheckBoxServlet.java
- CheckBoxApp.java
CheckBoxServlet.java extends the WebContainerServlet and is responsible for creating a new application instance and returns a new instance of CheckBoxApp. We have created a grid here and have added two check box items into it. On the first check box object we have added the action listener and on another check box is simple without any action. Following is the full example code of our application as follows:
CheckBoxServlet.java
package check;
|
CheckBoxApp.java
package check;
|
Output: