Home arrow Java & J2EE arrow Page 2 - Java's Basic User Interface Components

Adding a Control to a Container - Java

To simplify user interaction and make data entry easier, you can use java controls. Controls are components, such as buttons, labels and text boxes, that can be added to containers like frames, panels and applets. The Java.awt package provides an integrated set of classes to manage user interface components.

  1. Java's Basic User Interface Components
  2. Adding a Control to a Container
  3. The Button Class
  4. The Label Class
  5. The Checkbox Class
  6. The CheckboxGroup Class
  7. The Choice List Class
  8. The TextField and TextArea Class
  9. Setting a Password Character
  10. TextArea
By: Gayathri Gokul
Rating: starstarstarstarstar / 22
October 20, 2003

print this article


In order to add a control to a container, you need to perform the following two steps.

  • Create an object of the control by passing the required arguments to the constructor.
  • Add the component (control) to the container.

    Controls in Java

    Controls Functions
    Textbox Accepts single line alphanumeric entry.
    TextAreaAccepts multiple line alphanumeric entry.
    Push button Triggers a sequence of actions.
    Label Displays Text.
    Check box Accepts data that has a yes/no value. More than one checkbox can be selected.
    Radio button Similar to check box except that it allows the user to select a single option from a group.
    Combo box Displays a drop-down list for single item selection. It allows new value to be entered.
    List box Similar to combo box except that it allows a user to select single or multiple items. New values cannot be entered.

    Classes Involved

    Controls Class
    Textbox TextField
    TextArea TextArea
    Push buttonButton
    Check box CheckBox
    Radio buttonCheckboxGroup with CheckBox
    Combo box Choice
    List box List

    >>> More Java & J2EE Articles          >>> More By Gayathri Gokul

    blog comments powered by Disqus
  • escort Bursa Bursa escort Antalya eskort


    - More Java Bugs Lead to More Attacks
    - Oracle's Java One Brings News, Surprises
    - Oracle Patches Java Runtime Environment
    - Apple Syncs Java Update with Oracle
    - Spring 3.1 Java Development Framework Compat...
    - Jelastic Java PaaS Availability and Pricing ...
    - NetBeans 7.1 Released, Supports JavaFX 2
    - SolarWinds Releases Newest Version of Java M...
    - Free Monitoring Tool for Java Apps on Heroku
    - Heroku Adds JCloud Platform Support, Java 7 ...
    - Java SE 8 Speculation in Full Swing
    - Java SE 7 Now Available
    - New JVM Language and Java Reporting Tool
    - Java 7 Release Update and New Eclipse Toolkit
    - The Best Java Netbeans IDE Plugins

    Developer Shed Affiliates


    Dev Shed Tutorial Topics: