SlideShare a Scribd company logo
1 of 16
Download to read 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

More Related Content

Similar to 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
 

Similar to 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
 

More from 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
 

More from 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
 

Recently uploaded

Introduction and significance of Symbiotic algae
Introduction and significance of  Symbiotic algaeIntroduction and significance of  Symbiotic algae
Introduction and significance of Symbiotic algaekushbuR
 
GBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) MetabolismGBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) MetabolismAreesha Ahmad
 
Heat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree daysHeat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree daysBrahmesh Reddy B R
 
NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.syedmuneemqadri
 
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...Sérgio Sacani
 
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonVital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonAftabAhmedRahimoon
 
MSCII_ FCT UNIT 5 TOXICOLOGY.pdf
MSCII_              FCT UNIT 5 TOXICOLOGY.pdfMSCII_              FCT UNIT 5 TOXICOLOGY.pdf
MSCII_ FCT UNIT 5 TOXICOLOGY.pdfSuchita Rawat
 
Terpineol and it's characterization pptx
Terpineol and it's characterization pptxTerpineol and it's characterization pptx
Terpineol and it's characterization pptxMuhammadRazzaq31
 
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...yogeshlabana357357
 
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...kevin8smith
 
GBSN - Microbiology (Unit 4) Concept of Asepsis
GBSN - Microbiology (Unit 4) Concept of AsepsisGBSN - Microbiology (Unit 4) Concept of Asepsis
GBSN - Microbiology (Unit 4) Concept of AsepsisAreesha Ahmad
 
Costs to heap leach gold ore tailings in Karamoja region of Uganda
Costs to heap leach gold ore tailings in Karamoja region of UgandaCosts to heap leach gold ore tailings in Karamoja region of Uganda
Costs to heap leach gold ore tailings in Karamoja region of UgandaTimothyOkuna
 
Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)adityawani683
 
GBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolationGBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolationAreesha Ahmad
 
Fun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfFun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfhoangquan21999
 
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxSaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxPat (JS) Heslop-Harrison
 
X-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center ChimneyX-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center ChimneySérgio Sacani
 
Electricity and Circuits for Grade 9 students
Electricity and Circuits for Grade 9 studentsElectricity and Circuits for Grade 9 students
Electricity and Circuits for Grade 9 studentslevieagacer
 
TEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdfTEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdfmarcuskenyatta275
 
GBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) EnzymologyGBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) EnzymologyAreesha Ahmad
 

Recently uploaded (20)

Introduction and significance of Symbiotic algae
Introduction and significance of  Symbiotic algaeIntroduction and significance of  Symbiotic algae
Introduction and significance of Symbiotic algae
 
GBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) MetabolismGBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) Metabolism
 
Heat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree daysHeat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree days
 
NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.
 
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
 
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonVital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
 
MSCII_ FCT UNIT 5 TOXICOLOGY.pdf
MSCII_              FCT UNIT 5 TOXICOLOGY.pdfMSCII_              FCT UNIT 5 TOXICOLOGY.pdf
MSCII_ FCT UNIT 5 TOXICOLOGY.pdf
 
Terpineol and it's characterization pptx
Terpineol and it's characterization pptxTerpineol and it's characterization pptx
Terpineol and it's characterization pptx
 
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...
Soil and Water Conservation Engineering (SWCE) is a specialized field of stud...
 
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...
Harry Coumnas Thinks That Human Teleportation is Possible in Quantum Mechanic...
 
GBSN - Microbiology (Unit 4) Concept of Asepsis
GBSN - Microbiology (Unit 4) Concept of AsepsisGBSN - Microbiology (Unit 4) Concept of Asepsis
GBSN - Microbiology (Unit 4) Concept of Asepsis
 
Costs to heap leach gold ore tailings in Karamoja region of Uganda
Costs to heap leach gold ore tailings in Karamoja region of UgandaCosts to heap leach gold ore tailings in Karamoja region of Uganda
Costs to heap leach gold ore tailings in Karamoja region of Uganda
 
Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)
 
GBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolationGBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolation
 
Fun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfFun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdf
 
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptxSaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
SaffronCrocusGenomicsThessalonikiOnlineMay2024TalkOnline.pptx
 
X-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center ChimneyX-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
 
Electricity and Circuits for Grade 9 students
Electricity and Circuits for Grade 9 studentsElectricity and Circuits for Grade 9 students
Electricity and Circuits for Grade 9 students
 
TEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdfTEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdf
 
GBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) EnzymologyGBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) Enzymology
 

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