SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
JAVA AWT
Simmi S
Department of Computer Science(UG)
Kristu Jayanti College , Bangalore
Simmi S,Dept of CS
Abstract Window Tool Kit
• Java AWT is an API that contains large number of classes and methods
to create and manage graphical user interface ( GUI ) applications.
• The AWT was designed to provide a common set of tools for GUI
design that could work on a variety of platforms.
• AWT was Java’s first GUI Framework.
• AWT is the foundation upon which Swing is made i.e Swing is a
improved GUI API that extends the AWT.
Simmi S,Dept of CS
AWT
• Java AWT components are platform-dependent i.e. components are
displayed according to the view of operating system.
• AWT is heavy weight i.e. its components are using the resources of
underlying operating system (OS)
• Java AWT components are platform-dependent i.e. components are
displayed according to the view of operating system.
• The java.awt package provides classes for AWT API such as TextField,
Label, TextArea, RadioButton, CheckBox, Choice, List etc.
Simmi S,Dept of CS
Java AWT Hierarchy
Simmi S,Dept of CS
Components
• All the elements like the button, text fields, scroll bars, etc. are called
components.
• In Java AWT, there are classes for each component as shown in above
diagram.
• In order to place every component in a particular position on a
screen, we need to add them to a container.
Simmi S,Dept of CS
Container
• The Container is a component in AWT that can contain another
components like buttons, textfields, labels etc.
• The classes that extends Container class are known as container such
as Frame, Dialog and Panel.
• It is basically a screen where the components are placed at their
specific locations.
• Thus it contains and controls the layout of components.
•
Simmi S,Dept of CS
Types of containers:
There are four types of containers in Java AWT:
• Window
• Panel
• Frame
• Dialog
Simmi S,Dept of CS
Types of containers:
• Window
• The window is the container that have no borders and menu bars.
You must use frame, dialog or another window for creating a window.
We need to create an instance of Window class to create this
container
• Panel
• The Panel is the container that doesn't contain title bar, border or
menu bar. It is generic container for holding the components. It can
have other components like button, text field etc. An instance of
Panel class creates a container, in which we can add components.
Simmi S,Dept of CS
Types of containers:
• Frame
• The Frame is the container that contain title bar and border and can
have menu bars.
• It can have other components like button, text field, scrollbar etc.
• Frame is most widely used container while developing an AWT
application.
• Frame is a subclass of Window and have resizing canvas.
Simmi S,Dept of CS
Types of containers:
• The Dialog control
• The Dialog control represents a top level window with a border and a
title used to take some form of input from the user.
• It inherits the Window class.
• Unlike Frame, it doesn't have maximize and minimize buttons.
• Frame and Dialog both inherits Window class.
• Frame has maximize and minimize buttons but Dialog doesn't have.
Simmi S,Dept of CS
Creating a Frame
There are two ways to create a Frame. They are,
• By Instantiating Frame class
• By extending Frame class
Simmi S,Dept of CS
Points to Remember:
• While creating a frame (either by instantiating or extending Frame
class), Following two attributes are must for visibility of the frame:
• setSize(int width, int height);
• setVisible(true);
• When you create other components like Buttons, TextFields, etc. Then
you need to add it to the frame by using the method -
add(Component's Object);
• You can add the following method also for resizing the frame -
setResizable(true);
Simmi S,Dept of CS
By Instantiating Frame class
Simmi S,Dept of CS
By extending Frame class
Simmi S,Dept of CS
By extending Frame class
Simmi S,Dept of CS
THANK YOU
Simmi S,Dept of CS

Mais conteúdo relacionado

Semelhante a The Concept of Abstract Window Took Kit In Java

Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window ToolkitRutvaThakkar1
 
Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window ToolkitRutvaThakkar1
 
Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chhom Karath
 
Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chhom Karath
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01Ankit Dubey
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01Ankit Dubey
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01JONDHLEPOLY
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01JONDHLEPOLY
 
Accessibility and universal usability
Accessibility and universal usabilityAccessibility and universal usability
Accessibility and universal usabilitySarah Hudson
 
Accessibility and universal usability
Accessibility and universal usabilityAccessibility and universal usability
Accessibility and universal usabilitySarah Hudson
 
Debugging MAD lecture june .pptx
Debugging MAD lecture june .pptxDebugging MAD lecture june .pptx
Debugging MAD lecture june .pptxArishaNaz2
 
Debugging MAD lecture june .pptx
Debugging MAD lecture june .pptxDebugging MAD lecture june .pptx
Debugging MAD lecture june .pptxArishaNaz2
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptKevinNemo
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptKevinNemo
 

Semelhante a The Concept of Abstract Window Took Kit In Java (20)

Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window Toolkit
 
Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window Toolkit
 
Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)
 
Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)Chapter iii(building a simple user interface)
Chapter iii(building a simple user interface)
 
GUI.pdf
GUI.pdfGUI.pdf
GUI.pdf
 
GUI.pdf
GUI.pdfGUI.pdf
GUI.pdf
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Applet in java
Applet in javaApplet in java
Applet in java
 
Applet in java
Applet in javaApplet in java
Applet in java
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Accessibility and universal usability
Accessibility and universal usabilityAccessibility and universal usability
Accessibility and universal usability
 
Accessibility and universal usability
Accessibility and universal usabilityAccessibility and universal usability
Accessibility and universal usability
 
Debugging MAD lecture june .pptx
Debugging MAD lecture june .pptxDebugging MAD lecture june .pptx
Debugging MAD lecture june .pptx
 
Debugging MAD lecture june .pptx
Debugging MAD lecture june .pptxDebugging MAD lecture june .pptx
Debugging MAD lecture june .pptx
 
Awt controls ppt
Awt controls pptAwt controls ppt
Awt controls ppt
 
Awt controls ppt
Awt controls pptAwt controls ppt
Awt controls ppt
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.ppt
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.ppt
 

Mais de simmis5

Software reuse is the use of existing artifacts to build new software compone...
Software reuse is the use of existing artifacts to build new software compone...Software reuse is the use of existing artifacts to build new software compone...
Software reuse is the use of existing artifacts to build new software compone...simmis5
 
Unified Modeling Language in Software Engineering
Unified Modeling Language in Software EngineeringUnified Modeling Language in Software Engineering
Unified Modeling Language in Software Engineeringsimmis5
 
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...simmis5
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Software Engineering :Project Management
Software Engineering :Project ManagementSoftware Engineering :Project Management
Software Engineering :Project Managementsimmis5
 
The Concept Of Multithreading In Java Programming
The Concept Of Multithreading In Java ProgrammingThe Concept Of Multithreading In Java Programming
The Concept Of Multithreading In Java Programmingsimmis5
 
Conditional Statements & Loops
Conditional Statements & LoopsConditional Statements & Loops
Conditional Statements & Loopssimmis5
 
STRING HANDLING FUNCTIONS.pdf
STRING HANDLING FUNCTIONS.pdfSTRING HANDLING FUNCTIONS.pdf
STRING HANDLING FUNCTIONS.pdfsimmis5
 
Multiplexer.pdf
Multiplexer.pdfMultiplexer.pdf
Multiplexer.pdfsimmis5
 
Encoder_decoder_si.pdf
Encoder_decoder_si.pdfEncoder_decoder_si.pdf
Encoder_decoder_si.pdfsimmis5
 
c_algo_flowchart.pdf
c_algo_flowchart.pdfc_algo_flowchart.pdf
c_algo_flowchart.pdfsimmis5
 

Mais de simmis5 (11)

Software reuse is the use of existing artifacts to build new software compone...
Software reuse is the use of existing artifacts to build new software compone...Software reuse is the use of existing artifacts to build new software compone...
Software reuse is the use of existing artifacts to build new software compone...
 
Unified Modeling Language in Software Engineering
Unified Modeling Language in Software EngineeringUnified Modeling Language in Software Engineering
Unified Modeling Language in Software Engineering
 
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Software Engineering :Project Management
Software Engineering :Project ManagementSoftware Engineering :Project Management
Software Engineering :Project Management
 
The Concept Of Multithreading In Java Programming
The Concept Of Multithreading In Java ProgrammingThe Concept Of Multithreading In Java Programming
The Concept Of Multithreading In Java Programming
 
Conditional Statements & Loops
Conditional Statements & LoopsConditional Statements & Loops
Conditional Statements & Loops
 
STRING HANDLING FUNCTIONS.pdf
STRING HANDLING FUNCTIONS.pdfSTRING HANDLING FUNCTIONS.pdf
STRING HANDLING FUNCTIONS.pdf
 
Multiplexer.pdf
Multiplexer.pdfMultiplexer.pdf
Multiplexer.pdf
 
Encoder_decoder_si.pdf
Encoder_decoder_si.pdfEncoder_decoder_si.pdf
Encoder_decoder_si.pdf
 
c_algo_flowchart.pdf
c_algo_flowchart.pdfc_algo_flowchart.pdf
c_algo_flowchart.pdf
 

Último

Cellular Communication and regulation of communication mechanisms to sing the...
Cellular Communication and regulation of communication mechanisms to sing the...Cellular Communication and regulation of communication mechanisms to sing the...
Cellular Communication and regulation of communication mechanisms to sing the...Nistarini College, Purulia (W.B) India
 
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...Sérgio Sacani
 
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243Sérgio Sacani
 
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...TALAPATI ARUNA CHENNA VYDYANAD
 
Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...Sérgio Sacani
 
Continuum emission from within the plunging region of black hole discs
Continuum emission from within the plunging region of black hole discsContinuum emission from within the plunging region of black hole discs
Continuum emission from within the plunging region of black hole discsSérgio Sacani
 
MIP Award presentation at the IEEE International Conference on Software Analy...
MIP Award presentation at the IEEE International Conference on Software Analy...MIP Award presentation at the IEEE International Conference on Software Analy...
MIP Award presentation at the IEEE International Conference on Software Analy...Annibale Panichella
 
Lubrication System in forced feed system
Lubrication System in forced feed systemLubrication System in forced feed system
Lubrication System in forced feed systemADB online India
 
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Ansari Aashif Raza Mohd Imtiyaz
 
The solar dynamo begins near the surface
The solar dynamo begins near the surfaceThe solar dynamo begins near the surface
The solar dynamo begins near the surfaceSérgio Sacani
 
family therapy psychotherapy types .pdf
family therapy psychotherapy types  .pdffamily therapy psychotherapy types  .pdf
family therapy psychotherapy types .pdfhaseebahmeddrama
 
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...Sérgio Sacani
 
Factor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandFactor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandRcvets
 
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxSaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxPat (JS) Heslop-Harrison
 
Quantifying Artificial Intelligence and What Comes Next!
Quantifying Artificial Intelligence and What Comes Next!Quantifying Artificial Intelligence and What Comes Next!
Quantifying Artificial Intelligence and What Comes Next!University of Hertfordshire
 
Tuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notesTuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notesjyothisaisri
 
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 Rp
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 RpWASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 Rp
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 RpSérgio Sacani
 
GBSN - Microbiology (Unit 7) Microbiology in Everyday Life
GBSN - Microbiology (Unit 7) Microbiology in Everyday LifeGBSN - Microbiology (Unit 7) Microbiology in Everyday Life
GBSN - Microbiology (Unit 7) Microbiology in Everyday LifeAreesha Ahmad
 
GBSN - Microbiology Lab (Microbiology Lab Safety Procedures)
GBSN -  Microbiology Lab (Microbiology Lab Safety Procedures)GBSN -  Microbiology Lab (Microbiology Lab Safety Procedures)
GBSN - Microbiology Lab (Microbiology Lab Safety Procedures)Areesha Ahmad
 

Último (20)

Cellular Communication and regulation of communication mechanisms to sing the...
Cellular Communication and regulation of communication mechanisms to sing the...Cellular Communication and regulation of communication mechanisms to sing the...
Cellular Communication and regulation of communication mechanisms to sing the...
 
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
 
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243
Constraints on Neutrino Natal Kicks from Black-Hole Binary VFTS 243
 
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
 
Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...
 
Continuum emission from within the plunging region of black hole discs
Continuum emission from within the plunging region of black hole discsContinuum emission from within the plunging region of black hole discs
Continuum emission from within the plunging region of black hole discs
 
MIP Award presentation at the IEEE International Conference on Software Analy...
MIP Award presentation at the IEEE International Conference on Software Analy...MIP Award presentation at the IEEE International Conference on Software Analy...
MIP Award presentation at the IEEE International Conference on Software Analy...
 
Lubrication System in forced feed system
Lubrication System in forced feed systemLubrication System in forced feed system
Lubrication System in forced feed system
 
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
 
The solar dynamo begins near the surface
The solar dynamo begins near the surfaceThe solar dynamo begins near the surface
The solar dynamo begins near the surface
 
family therapy psychotherapy types .pdf
family therapy psychotherapy types  .pdffamily therapy psychotherapy types  .pdf
family therapy psychotherapy types .pdf
 
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
 
Factor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandFactor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary Gland
 
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxSaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
 
Quantifying Artificial Intelligence and What Comes Next!
Quantifying Artificial Intelligence and What Comes Next!Quantifying Artificial Intelligence and What Comes Next!
Quantifying Artificial Intelligence and What Comes Next!
 
Tuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notesTuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notes
 
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 Rp
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 RpWASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 Rp
WASP-69b’s Escaping Envelope Is Confined to a Tail Extending at Least 7 Rp
 
GBSN - Microbiology (Unit 7) Microbiology in Everyday Life
GBSN - Microbiology (Unit 7) Microbiology in Everyday LifeGBSN - Microbiology (Unit 7) Microbiology in Everyday Life
GBSN - Microbiology (Unit 7) Microbiology in Everyday Life
 
GBSN - Microbiology Lab (Microbiology Lab Safety Procedures)
GBSN -  Microbiology Lab (Microbiology Lab Safety Procedures)GBSN -  Microbiology Lab (Microbiology Lab Safety Procedures)
GBSN - Microbiology Lab (Microbiology Lab Safety Procedures)
 
Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
 

The Concept of Abstract Window Took Kit In Java

  • 1. JAVA AWT Simmi S Department of Computer Science(UG) Kristu Jayanti College , Bangalore Simmi S,Dept of CS
  • 2. Abstract Window Tool Kit • Java AWT is an API that contains large number of classes and methods to create and manage graphical user interface ( GUI ) applications. • The AWT was designed to provide a common set of tools for GUI design that could work on a variety of platforms. • AWT was Java’s first GUI Framework. • AWT is the foundation upon which Swing is made i.e Swing is a improved GUI API that extends the AWT. Simmi S,Dept of CS
  • 3. AWT • Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system. • AWT is heavy weight i.e. its components are using the resources of underlying operating system (OS) • Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system. • The java.awt package provides classes for AWT API such as TextField, Label, TextArea, RadioButton, CheckBox, Choice, List etc. Simmi S,Dept of CS
  • 5. Components • All the elements like the button, text fields, scroll bars, etc. are called components. • In Java AWT, there are classes for each component as shown in above diagram. • In order to place every component in a particular position on a screen, we need to add them to a container. Simmi S,Dept of CS
  • 6. Container • The Container is a component in AWT that can contain another components like buttons, textfields, labels etc. • The classes that extends Container class are known as container such as Frame, Dialog and Panel. • It is basically a screen where the components are placed at their specific locations. • Thus it contains and controls the layout of components. • Simmi S,Dept of CS
  • 7. Types of containers: There are four types of containers in Java AWT: • Window • Panel • Frame • Dialog Simmi S,Dept of CS
  • 8. Types of containers: • Window • The window is the container that have no borders and menu bars. You must use frame, dialog or another window for creating a window. We need to create an instance of Window class to create this container • Panel • The Panel is the container that doesn't contain title bar, border or menu bar. It is generic container for holding the components. It can have other components like button, text field etc. An instance of Panel class creates a container, in which we can add components. Simmi S,Dept of CS
  • 9. Types of containers: • Frame • The Frame is the container that contain title bar and border and can have menu bars. • It can have other components like button, text field, scrollbar etc. • Frame is most widely used container while developing an AWT application. • Frame is a subclass of Window and have resizing canvas. Simmi S,Dept of CS
  • 10. Types of containers: • The Dialog control • The Dialog control represents a top level window with a border and a title used to take some form of input from the user. • It inherits the Window class. • Unlike Frame, it doesn't have maximize and minimize buttons. • Frame and Dialog both inherits Window class. • Frame has maximize and minimize buttons but Dialog doesn't have. Simmi S,Dept of CS
  • 11. Creating a Frame There are two ways to create a Frame. They are, • By Instantiating Frame class • By extending Frame class Simmi S,Dept of CS
  • 12. Points to Remember: • While creating a frame (either by instantiating or extending Frame class), Following two attributes are must for visibility of the frame: • setSize(int width, int height); • setVisible(true); • When you create other components like Buttons, TextFields, etc. Then you need to add it to the frame by using the method - add(Component's Object); • You can add the following method also for resizing the frame - setResizable(true); Simmi S,Dept of CS
  • 13. By Instantiating Frame class Simmi S,Dept of CS
  • 14. By extending Frame class Simmi S,Dept of CS
  • 15. By extending Frame class Simmi S,Dept of CS