SlideShare a Scribd company logo
Graphical User
Interface
Java GUI
• GUI means ”Graphical
User Interface.”
• There are three graphic
classes in java:
• Awt
• Swing
• JavaFX
Java AWT
• AWT have 12 packages & 370 classes.
• Most commonly used:
1. java.awt
2. java.awt.event
• java.awt package contains the core AWT graphics classes:
1. GUI component classes, such as button, textfield,
and label.
2. GUI container classes, such as frame and panel.
3. Layout managers, such
as flowlayout, borderlayout and gridlayout.
4. Custom graphics classes, such
as graphics, color and font.
Java AWT Event
• The java.awt.event package supports event handling:
1. Event classes, such
as ActionEvent, MouseEvent, KeyEvent and WindowEvent
2. Event Listener Interfaces, such
as ActionListener, MouseListener, MouseMotionListener, KeyListener and
WindowListener
3. Event Listener Adapter classes, such as MouseAdapter, KeyAdapter,
and WindowAdapter
Containers &
Components
• There are two types of GUI elements:
1. Component: Components are elementary GUI entities, such
as Button, Label, and TextField.
2. Container: Containers, such as Frame and Panel, are used
to hold components in a specific layout (such
as FlowLayout or GridLayout). A container can also hold sub-
containers.
Layout Manager
Following are several layout
managers:
Border
layout
Flow
layout
GridBag
layout
To arrange the components inside a
container we use the layout
manager.
• Border Layout : The default layout manager for
every JFrame is BorderLayout. It places
components in upto five places which is top,
bottom, left, right and center.
• Flow Layout : FlowLayout simply lays the
components in a row one after the other, it is the
default layout manager for every JPanel.
• Gridbag Layout : GridBagLayout places the
components in a grid which allows the
components to span more than one cell.
Swing
• Swing is part of the “Java
Foundation Classes (JFC).”
• Swing provides a huge and
comprehensive collection
of reusable GUI
components.
• There are 18 packages &
737 classes in Swing.
Swing
Features
• Swing supports mouse-less operation, i.e., it can
operate entirely using keyboard.
• Swing components support “tool-tips.”
• You can drag-and-drop a Swing component.
Java Swing Class
Hierarchy
• All the components in swing
like JButton, JComboBox,
JList, JLabel are inherited
from the JComponent class
which can be added to the
container classes. Containers
are the windows like frame
and dialog boxes. Basic
swing components are the
building blocks of any GUI
application.
• Containers like JFrame and
JDialog can only add a
component to itself.
Thank You
Ad

More Related Content

Similar to Graphical User Interface (GUI) (20)

GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
rishi ram khanal
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
Hemo Chella
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
Hemo Chella
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
sotlsoc
 
Chapter One Java Swings GUA programming.ppt
Chapter One Java Swings GUA programming.pptChapter One Java Swings GUA programming.ppt
Chapter One Java Swings GUA programming.ppt
MohamedAhmed686097
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Knoldus Inc.
 
Demo on JavaFX
Demo on JavaFXDemo on JavaFX
Demo on JavaFX
Knoldus Inc.
 
Java_Unit6pptx__2024_04_13_18_18_07.pptx
Java_Unit6pptx__2024_04_13_18_18_07.pptxJava_Unit6pptx__2024_04_13_18_18_07.pptx
Java_Unit6pptx__2024_04_13_18_18_07.pptx
lakhatariyajaimin09
 
GUI.pptx
GUI.pptxGUI.pptx
GUI.pptx
18csjeyavarthini
 
Report swings
Report swingsReport swings
Report swings
Alisha Korpal
 
14a-gui.ppt
14a-gui.ppt14a-gui.ppt
14a-gui.ppt
DrDGayathriDevi
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating gui
Viên Mai
 
AWT.pptx
AWT.pptxAWT.pptx
AWT.pptx
FAHMIDAASEEZ1
 
Java GUI Programming for beginners-graphics.pdf
Java GUI Programming for beginners-graphics.pdfJava GUI Programming for beginners-graphics.pdf
Java GUI Programming for beginners-graphics.pdf
PBMaverick
 
Swing
SwingSwing
Swing
Jaydeep Viradiya
 
Gui
GuiGui
Gui
Sardar Alam
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
Mazenetsolution
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
backdoor
 
Tycs advance java sem 5 unit 1,2,3,4 (2017)
Tycs advance java sem 5 unit 1,2,3,4 (2017)Tycs advance java sem 5 unit 1,2,3,4 (2017)
Tycs advance java sem 5 unit 1,2,3,4 (2017)
WE-IT TUTORIALS
 
CSO_Gaddis_Java_Java_Complete_Chapter7.ppt
CSO_Gaddis_Java_Java_Complete_Chapter7.pptCSO_Gaddis_Java_Java_Complete_Chapter7.ppt
CSO_Gaddis_Java_Java_Complete_Chapter7.ppt
santhan13
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
rishi ram khanal
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
sotlsoc
 
Chapter One Java Swings GUA programming.ppt
Chapter One Java Swings GUA programming.pptChapter One Java Swings GUA programming.ppt
Chapter One Java Swings GUA programming.ppt
MohamedAhmed686097
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Knoldus Inc.
 
Java_Unit6pptx__2024_04_13_18_18_07.pptx
Java_Unit6pptx__2024_04_13_18_18_07.pptxJava_Unit6pptx__2024_04_13_18_18_07.pptx
Java_Unit6pptx__2024_04_13_18_18_07.pptx
lakhatariyajaimin09
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating gui
Viên Mai
 
Java GUI Programming for beginners-graphics.pdf
Java GUI Programming for beginners-graphics.pdfJava GUI Programming for beginners-graphics.pdf
Java GUI Programming for beginners-graphics.pdf
PBMaverick
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
Mazenetsolution
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
backdoor
 
Tycs advance java sem 5 unit 1,2,3,4 (2017)
Tycs advance java sem 5 unit 1,2,3,4 (2017)Tycs advance java sem 5 unit 1,2,3,4 (2017)
Tycs advance java sem 5 unit 1,2,3,4 (2017)
WE-IT TUTORIALS
 
CSO_Gaddis_Java_Java_Complete_Chapter7.ppt
CSO_Gaddis_Java_Java_Complete_Chapter7.pptCSO_Gaddis_Java_Java_Complete_Chapter7.ppt
CSO_Gaddis_Java_Java_Complete_Chapter7.ppt
santhan13
 

More from SAGARDAVE29 (12)

ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
SAGARDAVE29
 
Exception Handling
Exception HandlingException Handling
Exception Handling
SAGARDAVE29
 
JAVA Multithreading
JAVA MultithreadingJAVA Multithreading
JAVA Multithreading
SAGARDAVE29
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
SAGARDAVE29
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
SAGARDAVE29
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
SAGARDAVE29
 
Exception handling
Exception handlingException handling
Exception handling
SAGARDAVE29
 
More oop in java
More oop in javaMore oop in java
More oop in java
SAGARDAVE29
 
Coding Style & Tips for JAVA
Coding Style & Tips for JAVACoding Style & Tips for JAVA
Coding Style & Tips for JAVA
SAGARDAVE29
 
Some Important Methods in JAVA
Some Important Methods in JAVASome Important Methods in JAVA
Some Important Methods in JAVA
SAGARDAVE29
 
Recursion
RecursionRecursion
Recursion
SAGARDAVE29
 
Inheritance & Polymorphism
Inheritance & PolymorphismInheritance & Polymorphism
Inheritance & Polymorphism
SAGARDAVE29
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
SAGARDAVE29
 
Exception Handling
Exception HandlingException Handling
Exception Handling
SAGARDAVE29
 
JAVA Multithreading
JAVA MultithreadingJAVA Multithreading
JAVA Multithreading
SAGARDAVE29
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
SAGARDAVE29
 
Exception handling
Exception handlingException handling
Exception handling
SAGARDAVE29
 
More oop in java
More oop in javaMore oop in java
More oop in java
SAGARDAVE29
 
Coding Style & Tips for JAVA
Coding Style & Tips for JAVACoding Style & Tips for JAVA
Coding Style & Tips for JAVA
SAGARDAVE29
 
Some Important Methods in JAVA
Some Important Methods in JAVASome Important Methods in JAVA
Some Important Methods in JAVA
SAGARDAVE29
 
Inheritance & Polymorphism
Inheritance & PolymorphismInheritance & Polymorphism
Inheritance & Polymorphism
SAGARDAVE29
 
Ad

Recently uploaded (20)

Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Ad

Graphical User Interface (GUI)

  • 2. Java GUI • GUI means ”Graphical User Interface.” • There are three graphic classes in java: • Awt • Swing • JavaFX
  • 3. Java AWT • AWT have 12 packages & 370 classes. • Most commonly used: 1. java.awt 2. java.awt.event • java.awt package contains the core AWT graphics classes: 1. GUI component classes, such as button, textfield, and label. 2. GUI container classes, such as frame and panel. 3. Layout managers, such as flowlayout, borderlayout and gridlayout. 4. Custom graphics classes, such as graphics, color and font.
  • 4. Java AWT Event • The java.awt.event package supports event handling: 1. Event classes, such as ActionEvent, MouseEvent, KeyEvent and WindowEvent 2. Event Listener Interfaces, such as ActionListener, MouseListener, MouseMotionListener, KeyListener and WindowListener 3. Event Listener Adapter classes, such as MouseAdapter, KeyAdapter, and WindowAdapter
  • 5. Containers & Components • There are two types of GUI elements: 1. Component: Components are elementary GUI entities, such as Button, Label, and TextField. 2. Container: Containers, such as Frame and Panel, are used to hold components in a specific layout (such as FlowLayout or GridLayout). A container can also hold sub- containers.
  • 6. Layout Manager Following are several layout managers: Border layout Flow layout GridBag layout To arrange the components inside a container we use the layout manager.
  • 7. • Border Layout : The default layout manager for every JFrame is BorderLayout. It places components in upto five places which is top, bottom, left, right and center. • Flow Layout : FlowLayout simply lays the components in a row one after the other, it is the default layout manager for every JPanel. • Gridbag Layout : GridBagLayout places the components in a grid which allows the components to span more than one cell.
  • 8. Swing • Swing is part of the “Java Foundation Classes (JFC).” • Swing provides a huge and comprehensive collection of reusable GUI components. • There are 18 packages & 737 classes in Swing.
  • 9. Swing Features • Swing supports mouse-less operation, i.e., it can operate entirely using keyboard. • Swing components support “tool-tips.” • You can drag-and-drop a Swing component.
  • 10. Java Swing Class Hierarchy • All the components in swing like JButton, JComboBox, JList, JLabel are inherited from the JComponent class which can be added to the container classes. Containers are the windows like frame and dialog boxes. Basic swing components are the building blocks of any GUI application. • Containers like JFrame and JDialog can only add a component to itself.