Java
  Home arrow Java arrow Page 6 - Using Abstract Windowing Toolkit (AWT) In Applications
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

Using Abstract Windowing Toolkit (AWT) In Applications
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    2003-09-29


    Table of Contents:
  • Using Abstract Windowing Toolkit (AWT) In Applications
  • Read On….Its Not That Abstract
  • Your Best Buddies….Java’s AWT
  • Features Of The Component Class
  • What Holds Components Together…The Container
  • How To Talk To Your Application

  • 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


    Using Abstract Windowing Toolkit (AWT) In Applications - How To Talk To Your Application
    ( Page 6 of 6 )

    The Dialog Class:

    Dialogs are pop-up windows that are used to accept input from a user. There are two kinds of dialog boxes-modal and modeless. Unlike a modeless dialog box, a modal dialog box does not allow a user to interact with other window while it is displayed. A frame or another dialog must own a dialog box. You cannot directly attached a dialog to an applet. You can attach a dialog to a frame.

    When you create a dialog box, you can specify whether you want a modal or modeless dialog box. You cannot change the “modality” of the dialog box after creating it. We use Dialog class for creating dialog boxes. The dialog class offers overloaded constructors.

    The following constructors create a dialog box that has a frame as its owner:

      •Dialog (Frame owner_frame)
      •Dialog (Frame owner_frame, String title).
      •Dialog (Frame owner_frame, String title, Boolean modal).
    The following constructors create a dialog box that has another dialog box as its owner:

      •Dialog(Dialog owner_dialog)
      •Dialog (Dialog owner_dialog, String title).
      •Dialog (Dialog owner_dialog, String title, Boolean modal).


    The single argument constructor creates a modeless dialog box without a title. The second argument that you could pass to a constructor is the title of the dialog box. To create a modal dialog box, you could use the third argument. An example is given below.
    Dialog dialog = new Dialog (frame, “Demo Of Dialog”, true);
    Getting To Know About Panels The Panel Class: Panels are used for organizing components. You can use the Layout Manager to decide how the components are to be arranged on the panel. Each panel can have a different layout. To create a panel, use the following command:
    Panel panel = new Panel ();
    Sub-Panels: You can also create what is called the “nested panels”, with one panel containing more than one sub-panels. You can nest panels, as many levels up as you like. Once you have created a component, the simplest way to add it to the container is to call the container’s add () method. For example:
    Panel Mainpanel, Subpanel1, Subpanel2; Mainpanel = new Panel (); Subpanel1 = new Panel (); Subpanel2 = new Panel (); Mainpanel.add(Subpanel1); Mainpanel.add(Subpanel2);
    So we have covered some basics about Java AWT, discussed at length about the Component class. Enumerated on the first component-the container and its various types like windows, Frame, Panel and Dialog boxes. In the next part of the tutorial we will see how to simplify user interaction and make data entry easier, with the use of use controls. Controls are components like buttons and text box, check box, radio button etc. that can be added to containers like frame, panels and applets. We will also cover additional information about Java AWT package which provide an integrated set of classes to manage user interface components and then write a few codes to test our knowledge.

     
     
    >>> 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 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek