Application Techniques

Using the JCheckBox Control

How to use the Swing check box control on a form.

About this technique



Java Client Techniques> Version 3 Swing-based controls


You'll learn about:

You can run this technique code from:

NOTE   First make sure that database is running on your localhost SilverStream Server

Related reading

See the chapter on the Form Designer in the Tools Guide

Getting the control state   Top of page

The following code uses the getState() method to determine the boolean state of the check box control chkUSCitizen. It then uses setText() to place a value in a text label lblCheckBoxState accordingly.

  private void handle_chkUSCitizen_valueChanged(AgoPropertyChangeEvent evt) 
      if (chkUSCitizen.getState()) 
        lblCheckBoxState.setText("State = True"); 
        lblCheckBoxState.setText("State = False"); 

Copyright © 2000, SilverStream Software, Inc. All rights reserved.