SlideShare una empresa de Scribd logo
1 de 5
Descargar para leer sin conexión
Core Java

Debasish Pratihari

Swing


Swing provides rich set of Components for
building GUI.



Swing provides a feature called pluggable
look-and-feel that makes possible to change
the appearance of a component.



Swing is a part of Java Foundation
Classes(JFC).



Swing gives Undo support.



Unlike AWT components, swing components are
not implemented by platform-specific code.
Instead, they are written entirely in java and
therefore, are platform independent. This
types of components are termed as light
weight components.



For Swing Components, you have to import
javax.swing package.

Highlights of Swing Components :







Pluggable look-and –feel
Similar looks in cross-platform
ToolTip test
Decorative Borders
Icons for many Components

Lecture/core/swing/19

Page #1

feel the Technology…
Core Java

Debasish Pratihari

Visual Introduction of Swing Components
Components

Class Name

Events

JLabel
JButton

ActionEvent

JToggleButton

ActionEvent
ItemEvent

JCheckBox

ItemEvent
ActionEvent

JRadioButton

ActionEvent
ItemEvent

JComboBox

ItemEvent

JList

ListSelectionEvent

JTextField

JTextArea

Lecture/core/swing/19

KeyEvent
FocusEvent

KeyEvent
FocusEvent

Page #2

feel the Technology…
Core Java
Components

Class Name

Debasish Pratihari

Events

JScrollBar

AdjustmentEvent

JSlider

ChangeEvent

JPasswordField

KeyEvent
FocusEvent

JTable

TableModelEvent

JTree

FocusEvent

JColorChooser

Lecture/core/swing/19

Page #3

feel the Technology…
Core Java

Debasish Pratihari

JDialog

JFileChooser

JTabbedPane

Lecture/core/swing/19

Page #4

feel the Technology…
Core Java

Debasish Pratihari

Top Level- Containers:


Swing provides three useful top-level container
classes as follows
 JFrame
 JDialog
 JApplet



You can optionally add a menu bar to a toplevel container. The menu bar is by convention
positioned within the top-level container, but
outside the content pane.



To be displayed on a screen, every GUI
Component must be part of a Containment
hierarchy.



A Containment hierarchy is a tree of
Components that has a top-level Container as
its root.



As a rule, a standalone application with a Swingbased GUI has at least one containment
hierarchy with a JFrame as its root.



A Swing-based applet has at least one
containment hierarchy, exactly one of which is
rooted by a JApplet object.

Window Panes :

Note :

The area of the window below the title bar is a
JRootPane Object
Optional menubar
layeredPane object of type JLayeredPane

contentPane object of type JInternalPane

Lecture/core/swing/19

Page #5

The contentPane is where
components are added
except Menubar.
A reference to
contentPane is returned
when you call the

getContentPane( )
method for the JFrame
object.

feel the Technology…

Más contenido relacionado

La actualidad más candente

Scala on-android
Scala on-androidScala on-android
Scala on-android
Max Lv
 
Common Client Rich Client Platforms
Common Client   Rich Client PlatformsCommon Client   Rich Client Platforms
Common Client Rich Client Platforms
Geertjan Wielenga
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Sujit Kumar
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
Jong Soon Bok
 

La actualidad más candente (20)

Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
 
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
 
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
 
Scala on-android
Scala on-androidScala on-android
Scala on-android
 
Angular js 2.0 beta
Angular js 2.0 betaAngular js 2.0 beta
Angular js 2.0 beta
 
java swing
java swingjava swing
java swing
 
Introduction to basics of java
Introduction to basics of javaIntroduction to basics of java
Introduction to basics of java
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Common Client Rich Client Platforms
Common Client   Rich Client PlatformsCommon Client   Rich Client Platforms
Common Client Rich Client Platforms
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java presentation
Java presentation Java presentation
Java presentation
 
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Di with dagger2 in android
Di with dagger2 in androidDi with dagger2 in android
Di with dagger2 in android
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Using Dagger in a Clean Architecture project
Using Dagger in a Clean Architecture projectUsing Dagger in a Clean Architecture project
Using Dagger in a Clean Architecture project
 
Java fx
Java fx Java fx
Java fx
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 

Destacado

Jammy Create presentation
Jammy Create presentationJammy Create presentation
Jammy Create presentation
Paul McElvaney
 

Destacado (20)

נוכחות אונליין - המכללה לעסקים קטנים, המכללה למנהל
נוכחות אונליין - המכללה לעסקים קטנים, המכללה למנהל    נוכחות אונליין - המכללה לעסקים קטנים, המכללה למנהל
נוכחות אונליין - המכללה לעסקים קטנים, המכללה למנהל
 
Paper Based Student Enrollment - Disgrace to Education Technology
Paper Based Student Enrollment - Disgrace to Education TechnologyPaper Based Student Enrollment - Disgrace to Education Technology
Paper Based Student Enrollment - Disgrace to Education Technology
 
Talking In Class
Talking In ClassTalking In Class
Talking In Class
 
Presentatie ANWB
Presentatie  ANWBPresentatie  ANWB
Presentatie ANWB
 
Hazel and Kate-Unison
Hazel and Kate-UnisonHazel and Kate-Unison
Hazel and Kate-Unison
 
Divosa v1.3
Divosa v1.3Divosa v1.3
Divosa v1.3
 
Python e 10 motivos por que devo conhece-la ?
Python e 10 motivos por que devo conhece-la ?Python e 10 motivos por que devo conhece-la ?
Python e 10 motivos por que devo conhece-la ?
 
Webtech 2010: twitter programming
Webtech 2010: twitter programmingWebtech 2010: twitter programming
Webtech 2010: twitter programming
 
Tibo Lezing 27 mei
Tibo Lezing 27 meiTibo Lezing 27 mei
Tibo Lezing 27 mei
 
Podiumkunst
PodiumkunstPodiumkunst
Podiumkunst
 
Maximising User Engagement from Sheffield City Council's James Hird
Maximising User Engagement from Sheffield City Council's James HirdMaximising User Engagement from Sheffield City Council's James Hird
Maximising User Engagement from Sheffield City Council's James Hird
 
101 Four Elements Of Email Marketing
101 Four Elements Of Email Marketing101 Four Elements Of Email Marketing
101 Four Elements Of Email Marketing
 
How To Make Doughnut!
How To Make Doughnut!How To Make Doughnut!
How To Make Doughnut!
 
Javaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java FrameworkJavaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java Framework
 
Rebecca Johnson, Cardiff
Rebecca Johnson, CardiffRebecca Johnson, Cardiff
Rebecca Johnson, Cardiff
 
Jammy Create presentation
Jammy Create presentationJammy Create presentation
Jammy Create presentation
 
Gary Pyke, SLSA Wales
Gary Pyke, SLSA WalesGary Pyke, SLSA Wales
Gary Pyke, SLSA Wales
 
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoardScenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Learning Pool CELEB event
Learning Pool CELEB eventLearning Pool CELEB event
Learning Pool CELEB event
 

Similar a Lecture 19

Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
backdoor
 
1. introduction to swing
1. introduction to swing1. introduction to swing
1. introduction to swing
Tuan Ngo
 
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
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating gui
Viên Mai
 

Similar a Lecture 19 (20)

Swing !!! y shikhar!!
Swing !!! y shikhar!!Swing !!! y shikhar!!
Swing !!! y shikhar!!
 
Report swings
Report swingsReport swings
Report swings
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
 
1. introduction to swing
1. introduction to swing1. introduction to swing
1. introduction to swing
 
Chapter 1 swings
Chapter 1 swingsChapter 1 swings
Chapter 1 swings
 
GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
 
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)
 
Java swing 1
Java swing 1Java swing 1
Java swing 1
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating gui
 
java presentation on Swings chapter java presentation on Swings
java presentation on Swings chapter java presentation on Swingsjava presentation on Swings chapter java presentation on Swings
java presentation on Swings chapter java presentation on Swings
 
Swing is not dead
Swing is not deadSwing is not dead
Swing is not dead
 
Swing components
Swing components Swing components
Swing components
 
JAVA (UNIT 5)
JAVA (UNIT 5)JAVA (UNIT 5)
JAVA (UNIT 5)
 
Swing
SwingSwing
Swing
 
Swing
SwingSwing
Swing
 
SwingApplet.pptx
SwingApplet.pptxSwingApplet.pptx
SwingApplet.pptx
 
swings.pptx
swings.pptxswings.pptx
swings.pptx
 
Advanced swing
Advanced swingAdvanced swing
Advanced swing
 
GUI.pptx
GUI.pptxGUI.pptx
GUI.pptx
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 

Más de Debasish Pratihari (19)

Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture25
Lecture25Lecture25
Lecture25
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Lecture 19

  • 1. Core Java Debasish Pratihari Swing  Swing provides rich set of Components for building GUI.  Swing provides a feature called pluggable look-and-feel that makes possible to change the appearance of a component.  Swing is a part of Java Foundation Classes(JFC).  Swing gives Undo support.  Unlike AWT components, swing components are not implemented by platform-specific code. Instead, they are written entirely in java and therefore, are platform independent. This types of components are termed as light weight components.  For Swing Components, you have to import javax.swing package. Highlights of Swing Components :      Pluggable look-and –feel Similar looks in cross-platform ToolTip test Decorative Borders Icons for many Components Lecture/core/swing/19 Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari Visual Introduction of Swing Components Components Class Name Events JLabel JButton ActionEvent JToggleButton ActionEvent ItemEvent JCheckBox ItemEvent ActionEvent JRadioButton ActionEvent ItemEvent JComboBox ItemEvent JList ListSelectionEvent JTextField JTextArea Lecture/core/swing/19 KeyEvent FocusEvent KeyEvent FocusEvent Page #2 feel the Technology…
  • 3. Core Java Components Class Name Debasish Pratihari Events JScrollBar AdjustmentEvent JSlider ChangeEvent JPasswordField KeyEvent FocusEvent JTable TableModelEvent JTree FocusEvent JColorChooser Lecture/core/swing/19 Page #3 feel the Technology…
  • 5. Core Java Debasish Pratihari Top Level- Containers:  Swing provides three useful top-level container classes as follows  JFrame  JDialog  JApplet  You can optionally add a menu bar to a toplevel container. The menu bar is by convention positioned within the top-level container, but outside the content pane.  To be displayed on a screen, every GUI Component must be part of a Containment hierarchy.  A Containment hierarchy is a tree of Components that has a top-level Container as its root.  As a rule, a standalone application with a Swingbased GUI has at least one containment hierarchy with a JFrame as its root.  A Swing-based applet has at least one containment hierarchy, exactly one of which is rooted by a JApplet object. Window Panes : Note : The area of the window below the title bar is a JRootPane Object Optional menubar layeredPane object of type JLayeredPane contentPane object of type JInternalPane Lecture/core/swing/19 Page #5 The contentPane is where components are added except Menubar. A reference to contentPane is returned when you call the getContentPane( ) method for the JFrame object. feel the Technology…