Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWT Fundamentals

Avatar for vidyasamir vidyasamir
September 15, 2026
1

AWT Fundamentals

AWT Fundamentals

Avatar for vidyasamir

vidyasamir

September 15, 2026

Transcript

  1. Shri. ShamraoPatil (Yadravkar) Educational & Charitable Trust’s Sharad Institute of

    Technology, College of Engineering Yadrav- (Ichalkaranji) (An Autonomous Institute) NBA Accredited Programmes, NAAC ‘A’ Grade Institution, ISO 9001:2015 Certified Institute, Recognized u/s 2(f) and 12(B) of the UGC Act 1956 AWT Fundamentals Mrs. Vidya S. Mali Asst. Professor,SITCOE,Yadrav
  2.  AWT stands for Abstract Window Toolkit.  AWT is

    a Java library used to create graphical user interfaces.  It provides classes for windows, buttons, labels, text input, menus and other GUI elements.  The main AWT package is java.awt.  AWT components are connected to native operating-system GUI components.  AWT also provides layout managers for arranging components.
  3.  Component is the basic building block of an AWT

    graphical interface.  A Component represents an object that can appear on the screen.  It can receive user input and participate in event handling.  Examples include Button, Label, Checkbox, Scrollbar, TextField and TextArea.  Common Component methods:  setSize() setLocation() setVisible() setEnabled()
  4.  Container is a special type of Component that can

    contain other components.  A container provides a place where controls can be added.  A layout manager determines how components are positioned inside the container.  Important AWT containers:  Panel  Window  Frame  Dialog
  5.  Window is a top-level container used to represent a

    graphical window.  Frame is a commonly used AWT window that contains a title bar, border and other window features.  Example:  Frame f = new Frame("My Application");  f.setSize(500, 300);  f.setVisible(true);  Frame is frequently used for standalone AWT applications.
  6.  Panel is a container used to group related components.

     A Panel normally exists inside another container such as a Frame.  It helps divide a large interface into smaller logical sections.  Example:  Panel p = new Panel();  p.add(new Button("OK"));  frame.add(p);  Panels are useful when designing forms and complex interfaces.
  7.  The basic process is:  1. Import the AWT

    package.  2. Create a Frame.  3. Set the title and window size.  4. Select a suitable layout manager.  5. Create GUI controls.  6. Add controls to the container.  7. Make the window visible.  Typical package: import java.awt.*;
  8. import java.awt.*; class LoginForm { public static void main(String[] args)

    { Frame f = new Frame("Login Form"); Label l1 = new Label("Username:"); Label l2 = new Label("Password:"); TextField t1 = new TextField(); TextField t2 = new TextField(); t2.setEchoChar('*'); Button b = new Button("Login"); f.setLayout(new FlowLayout()); f.add(l1); f.add(t1); f.add(l2); f.add(t2); f.setSize(300, 200); f.setVisible(true); }} f.add(b);
  9.  AWT provides classes for developing graphical interfaces.  Component

    is the basic GUI element.  Container holds and organizes components.  Window represents a top-level graphical window.  Frame provides a standard application window.  Panel groups related components.  Windowed programs use containers, controls and layout managers.  Applets used a lifecycle-based execution model but are now obsolete.