Java
  Home arrow Java arrow Page 6 - Using Abstract Windowing Toolkit (AWT)...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
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? 
JAVA

Using Abstract Windowing Toolkit (AWT) In Applications
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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 PanelsThe 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.
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    JAVA ARTICLES

    - 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...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway