Java
  Home arrow Java arrow Page 5 - 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 - What Holds Components Together…The Container
    ( Page 5 of 6 )

    Containers:
    Some components can also act as containers. A window for example, can be a part of another container. At the same time it can be a parent to other components, such as textbox, and a checkbox, it is a container as well. The container class is a specialized subclass of the Component class. A container may contain zero or more components. These components are called siblings, since they have the same parent window. There are three main types of containers-Window, Applet and Panel. There are two types of windows-Frame and Dialog. A frame is a rectangular box with a title and resize button. A dialog box is similar to a frame except that it cannot be resized and does not have a menu bar.

    The Frame Class:
    A frame is a powerful feature of AWT. You can create a window for your application using Frame class. A frame has a title bar, resizable border and an optional menu bar. You can add components to the frame using add () method as frames are derived form java.awt.container. The Border layout is the default layout of the frame. A frame receives mouse events, keyboard events and focus events.

    The constructor of the Frame class receives the title of the frame as parameter. The string or name you specify will be displayed as the title of the frame.

    Frame f = new Frame (“Frame Window Demo”);
    After the window is created, it can be displayed by calling the setVisible () method and can be sized by calling the setSize () method. The program below displays a frame.
    Import java.awt.*; Public class frame extends Frame { Public static void main (String arg[]) { Frame frm; frm = new Frame(“My First AWT Container-The Frame”); frm.setSize(300,400); frm.setBackground (Color.red); frm.setVisible(true) } }

    Save the above program as frame.java, compile using Javac filename.java and execute using Java file name. The output will be a frame window with the title “My Frist AWT Container-The Frame”.

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