Java
  Home arrow Java arrow Page 6 - Java's Basic User Interface Components
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
JAVA

Java's Basic User Interface Components
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 15
    2003-10-20


    Table of Contents:
  • Java's Basic User Interface Components
  • Adding a Control to a Container
  • The Button Class
  • The Label Class
  • The Checkbox Class
  • The CheckboxGroup Class
  • The Choice List Class
  • The TextField and TextArea Class
  • Setting a Password Character
  • TextArea

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Java's Basic User Interface Components - The CheckboxGroup Class
    ( Page 6 of 10 )

    CheckboxGroup is also called like a radio button or exclusive check boxes. To organize several Checkboxes into a group so that only one can be selected at a time, a CheckboxGroup object is created with the statement such as follows:

    CheckboxGroup radio = new CheckboxGroup ();

    The CheckboxGroup keeps track of all the check boxes in its group. We have to use this object as an extra argument to the Checkbox constructor.

    Checkbox (String, CheckboxGroup, Boolean) creates a checkbox labeled with the given string that belongs to the CheckboxGroup indicated in the second argument. The last argument equals true if box is checked, false otherwise.

    The following is an applet to enable you to select one of the ways to connect to the Internet.

    Example 5

    /*
    <Applet code= “ChkGroup.class”
    Width = 200
    Height = 150>
    </applet>
    */

    Import java.awt.*;

    Public class ChkGroup extends java.applet.Applet
    {
    CheckboxGroup cbgr = new CheckboxGroup();
    Checkbox c1 = new Checkbox (“America Online”, cbgr, false);
    Checkbox c2 = new Checkbox (“MSN”, cbgr, false);
    Checkbox c3 = new Checkbox (“NetZero”, cbgr, false);
    Checkbox c4 = new Checkbox (“EarthLink”, cbgr, false);
    Checkbox c5 = new Checkbox (“Bellsouth DSL”, cbgr, true);

    Public void init(){
    add(c1);
    add(c2);
    add(c3);
    add(c4);
    add(c5);
    }
    }

    The setCurrent(checkbox) method can be used to make the set of currently selected check boxes in the group. There is also a getCurrent() method, which returns the currently selected checkbox.

     
     
    >>> More Java Articles          >>> More By Gayathri Gokul
     

       

    JAVA ARTICLES

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek