SlideShare a Scribd company logo
1 of 8
1
09/12/2017
AWT Packages , Containers and Components
2
AWT (Abstract Window Toolkit)
AWT – The Abstract Window Toolkit provides basic graphics tools
(tools for putting information on the screen).
AWT contains numerous classes and methods that allow you to create and
manage applet windows and standard windows that run in a GUI environment,
such as Windows The AWT classes are contained in the java.awt package.
The AWT defines windows based on a class hierarchy that adds functionality at
each level. The two most common windows are those derived from Panel used
by applets and Frame that creates standard windows.
3
Container – a graphic element that can hold other
graphic elements (and is itself a Component).
The container class is an abstract subclass of Component. The class is
responsible for laying out any components it contains through using
various layout managers.
Component – a graphic element (such as a Button or a
TextArea) provided by a graphics toolkit.
Component is an abstract class that encapsulates all of the user
interface elements that are displayed on the screen and that interact
with the user.
Containers & Components4
Containers & Components
 The job of a Container is to hold and display Components
 Some common subclasses of Component are Button,
Checkbox, Label, Scrollbar, TextField , and TextArea
 A Container is also a Component
This allows Containers to be nested
 Some Container subclasses are Panel (and Applet), Window,
and Frame
5
Creating Containers
Frame frame=new Frame(“My Frame”);
Pane pane=new Pane();
6
Creating components
Label lab = new Label ("Hi, Java!");
Button but = new Button ("Click me!");
Checkbox check_me = new Checkbox (“Check");
TextField txt = new TextField ("Initial text.", 20);
7
Example…..
import java.awt.*;
public class Test extends Frame {
public void test() {
Frame frame=new Frame("My Frame");
Button button=new Button("Button");
Label label=new Label("Simple Test");
TextField textfield=new TextField(20);
Panel panel=new Panel();
panel.add(label);
panel.add(textfield);
panel.add(button);
frame.add(panel);
frame.setLayout(new FlowLayout());
frame.setSize(400,300);
frame.setVisible(true); }
public static void main(String args[]) {
Test t=new Test();
t.test();
}
}
8

More Related Content

What's hot

Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 
android activity
android activityandroid activity
android activity
Deepa Rani
 

What's hot (20)

Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Android resources
Android resourcesAndroid resources
Android resources
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
Android activity
Android activityAndroid activity
Android activity
 
Applets
AppletsApplets
Applets
 
input/ output in java
input/ output  in javainput/ output  in java
input/ output in java
 
Java - Generic programming
Java - Generic programmingJava - Generic programming
Java - Generic programming
 
android activity
android activityandroid activity
android activity
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in java
 
Files in java
Files in javaFiles in java
Files in java
 
Java swing
Java swingJava swing
Java swing
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 

Similar to AWT Packages , Containers and Components

Similar to AWT Packages , Containers and Components (20)

UNIT-2-AJAVA.pdf
UNIT-2-AJAVA.pdfUNIT-2-AJAVA.pdf
UNIT-2-AJAVA.pdf
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window Toolkit
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
AWT controls, Listeners
AWT controls, ListenersAWT controls, Listeners
AWT controls, Listeners
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
 
AWT controls, Listeners
AWT controls, ListenersAWT controls, Listeners
AWT controls, Listeners
 
Computer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptxComputer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptx
 
Java swing 1
Java swing 1Java swing 1
Java swing 1
 
AWT.pptx
AWT.pptxAWT.pptx
AWT.pptx
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
Java AWT and Java FX
Java AWT and Java FXJava AWT and Java FX
Java AWT and Java FX
 
GUI JAVA PROG ~hmftj
GUI  JAVA PROG ~hmftjGUI  JAVA PROG ~hmftj
GUI JAVA PROG ~hmftj
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
AWT information
AWT informationAWT information
AWT information
 
Java Swing
Java SwingJava Swing
Java Swing
 
28 awt
28 awt28 awt
28 awt
 
Gui
GuiGui
Gui
 

Recently uploaded

Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
pritamlangde
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 

AWT Packages , Containers and Components

  • 2. AWT Packages , Containers and Components 2
  • 3. AWT (Abstract Window Toolkit) AWT – The Abstract Window Toolkit provides basic graphics tools (tools for putting information on the screen). AWT contains numerous classes and methods that allow you to create and manage applet windows and standard windows that run in a GUI environment, such as Windows The AWT classes are contained in the java.awt package. The AWT defines windows based on a class hierarchy that adds functionality at each level. The two most common windows are those derived from Panel used by applets and Frame that creates standard windows. 3
  • 4. Container – a graphic element that can hold other graphic elements (and is itself a Component). The container class is an abstract subclass of Component. The class is responsible for laying out any components it contains through using various layout managers. Component – a graphic element (such as a Button or a TextArea) provided by a graphics toolkit. Component is an abstract class that encapsulates all of the user interface elements that are displayed on the screen and that interact with the user. Containers & Components4
  • 5. Containers & Components  The job of a Container is to hold and display Components  Some common subclasses of Component are Button, Checkbox, Label, Scrollbar, TextField , and TextArea  A Container is also a Component This allows Containers to be nested  Some Container subclasses are Panel (and Applet), Window, and Frame 5
  • 6. Creating Containers Frame frame=new Frame(“My Frame”); Pane pane=new Pane(); 6
  • 7. Creating components Label lab = new Label ("Hi, Java!"); Button but = new Button ("Click me!"); Checkbox check_me = new Checkbox (“Check"); TextField txt = new TextField ("Initial text.", 20); 7
  • 8. Example….. import java.awt.*; public class Test extends Frame { public void test() { Frame frame=new Frame("My Frame"); Button button=new Button("Button"); Label label=new Label("Simple Test"); TextField textfield=new TextField(20); Panel panel=new Panel(); panel.add(label); panel.add(textfield); panel.add(button); frame.add(panel); frame.setLayout(new FlowLayout()); frame.setSize(400,300); frame.setVisible(true); } public static void main(String args[]) { Test t=new Test(); t.test(); } } 8