SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Written by
Shraddha Sheth
Neel Shah
o Creating Windows
o Creating a Window
o Components and Containers
o Basics of Components
o Using Containers
o Containers Layout Managers
o Adding a Menu to a Window
o Applets

JFC – JavaTM
Foundation Classes
Encompass a group of features for constructing graphical
user interfaces (GUI).
Implemented without any native code.
“Swing” is the codename of the project that developed the
first JFC components (JFC 1.11
).
The name “Swing” is frequently used to refer to new
components and related API.
JFC includes:
The Swing Components
Dialog, Tabbed pane, Buttons, File Chooser, ...
Pluggable Look and Feel
Accessibility API
Screen readers, Braille displays, ...
Java 2DTM
API (Java 2 Platform only)
Drag and Drop (Java 2 Platform only)
Between Java applications and native applications.
Each picture shows the same program but with
a different look and feel
javax.swing.plaf.metal.MetalLookAndFeel
javax.swing.plaf.motif.MotifLookAndFeel
Javax.swing.plaf.windows.WindowsLookAn
dFeel
import javax.swing.UIManager;
static setLookAndFeel() method that is defined in the
UIManager class.
This method can throw an exception of
ClassNotFoundException if the look-and-feel class cannot be
found,
For example:
try {
 UIManager.setLookAndFeel(“com.sun.java.swing.plaf.motif.MotifL
ookAndFeel”);
} catch(Exception e) {
 System.err.println(“Look and feel not set.”);
}
UIManager.LookAndFeelInfo[]
looks = UIManager.getInstalledLookAndFeels();
for( UIManager.LookAndFeelInfo look : looks)
System.out.println(look.getClassName());
Java Default Look And Feel
UIManager.setLookAndFeel
( UIManager.getCrossPlatformLookAndFeel());
Swing provides many standard GUI components
such as buttons, lists, menus, and text areas,
which you combine to create your program's GUI.
Swing provides containers such as a window.
top level: frames, dialogs
intermediate level: panel, scroll pane, tabbed pane, ...
View Components
Descendents of the java.awt.Container class
Components that can contain other components.
Use a layout manager to position and size the
components contained in them.
Components are added to a container using one
of the various forms of its add method
Depending on which layout manager is used by the
container
panel.add(component);
Every program that presents a Swing GUI
contains at least one top-level container.
A Top level container provides the support that
Swing components need to perform their painting
and event-handling.
Swing provides four top-level containers:
JFrame (Main window)
JDialog (Base For Dialogs)
JApplet (An applet display area within a browser
window)
JWindow (Secondary Display Devices)
To appear on screen, every GUI component must be part
of a containment hierarchy, with a top-level container
as its root.
Each top-level container has a content pane that contains
visible components in that top-level container’s GUI.
A top-level container can not contain another top
level container.
A frame implemented as an instance of the JFrame
class, is a window that has decorations such as a
border, a title and buttons for closing and iconifying
the window.
Applications with a GUI typically use at least one
frame.
import javax.swing.*;
public class HelloWorldSwing {
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
final JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label); // 1.4
// OR USE THIS frame.add(label); JDK 5
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Position (x,y)
Name .setName() .getName();
Size
Foreground And Background Color
Font
Cursor
State (setEnabled ([True/False])) isEnable()
Visible (setVisible([True/False])) isVisible()
Valid isValid()
Position is defined by x and y coordinates of type int,
or by an object of type java.awt.Point.
Size is defined by width and height, also values of
type int, or by an object of type java.awt.Dimension.
A Rectangle specifies an area in a coordinate space
that is enclosed by the Rectangle object's upper-left
point (x,y) in the coordinate space, its width, and its
height.
The decorations on a frame are platform dependent.
A JApplet object has the same arrangement of panes
as a JFrame object.
Window class and its subclasses, as objects of type
Window (or of a subclass type) can’t be contained in
another container.

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
Java swing
Java swingJava swing
Java swing
 
Swing
SwingSwing
Swing
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
 
Complete java swing
Complete java swingComplete java swing
Complete java swing
 
Basic using of Swing in Java
Basic using of Swing in JavaBasic using of Swing in Java
Basic using of Swing in Java
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
Introdu.awt
Introdu.awtIntrodu.awt
Introdu.awt
 
Swings in java
Swings in javaSwings in java
Swings in java
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Java
 
04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorial
 
Jdbc
JdbcJdbc
Jdbc
 
GUI Programming with Java
GUI Programming with JavaGUI Programming with Java
GUI Programming with Java
 
java swing
java swingjava swing
java swing
 
Java Swing
Java SwingJava Swing
Java Swing
 
Java swing and events
Java swing and eventsJava swing and events
Java swing and events
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
tL19 awt
tL19 awttL19 awt
tL19 awt
 

Andere mochten auch

6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in javaDeepak Sharma
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cyclemyrajendra
 
Java applets
Java appletsJava applets
Java appletslopjuan
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsTrinity Dwarka
 
Multi-threaded Programming in JAVA
Multi-threaded Programming in JAVAMulti-threaded Programming in JAVA
Multi-threaded Programming in JAVAVikram Kalyani
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Appletsamitksaha
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART IIOXUS 20
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1PRN USM
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaRaghu nath
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 

Andere mochten auch (20)

java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)
 
Java swing
Java swingJava swing
Java swing
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
 
Java awt
Java awtJava awt
Java awt
 
Java applets
Java appletsJava applets
Java applets
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Java applets
Java appletsJava applets
Java applets
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
 
Multi-threaded Programming in JAVA
Multi-threaded Programming in JAVAMulti-threaded Programming in JAVA
Multi-threaded Programming in JAVA
 
Gui
GuiGui
Gui
 
Java/Swing
Java/SwingJava/Swing
Java/Swing
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART II
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
Applet java
Applet javaApplet java
Applet java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 

Ähnlich wie JFC - Java Foundation Classes Guide for Creating GUIs

GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.pptTabassumMaktum
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892renuka gavli
 
Computer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptxComputer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptxjonathancapitulo2
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating guiViên Mai
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1sotlsoc
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)Narayana Swamy
 
Java AWT and Java FX
Java AWT and Java FXJava AWT and Java FX
Java AWT and Java FXpratikkadam78
 
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
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swingbackdoor
 
AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and ComponentsSohanur63
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignKnoldus Inc.
 

Ähnlich wie JFC - Java Foundation Classes Guide for Creating GUIs (20)

Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
 
GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892
 
Computer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptxComputer Programming NC III - Java Swing.pptx
Computer Programming NC III - Java Swing.pptx
 
Slot04 creating gui
Slot04 creating guiSlot04 creating gui
Slot04 creating gui
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)
 
JavaFX ALA ppt.pptx
JavaFX ALA ppt.pptxJavaFX ALA ppt.pptx
JavaFX ALA ppt.pptx
 
08graphics
08graphics08graphics
08graphics
 
Java AWT and Java FX
Java AWT and Java FXJava AWT and Java FX
Java AWT and Java FX
 
L11cs2110sp13
L11cs2110sp13L11cs2110sp13
L11cs2110sp13
 
Java swing 1
Java swing 1Java swing 1
Java swing 1
 
UNIT-2-AJAVA.pdf
UNIT-2-AJAVA.pdfUNIT-2-AJAVA.pdf
UNIT-2-AJAVA.pdf
 
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)
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
 
AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
 
Report swings
Report swingsReport swings
Report swings
 
Java session13
Java session13Java session13
Java session13
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Kürzlich hochgeladen (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

JFC - Java Foundation Classes Guide for Creating GUIs

  • 2. o Creating Windows o Creating a Window o Components and Containers o Basics of Components o Using Containers o Containers Layout Managers o Adding a Menu to a Window o Applets 
  • 3. JFC – JavaTM Foundation Classes Encompass a group of features for constructing graphical user interfaces (GUI). Implemented without any native code. “Swing” is the codename of the project that developed the first JFC components (JFC 1.11 ). The name “Swing” is frequently used to refer to new components and related API.
  • 4. JFC includes: The Swing Components Dialog, Tabbed pane, Buttons, File Chooser, ... Pluggable Look and Feel Accessibility API Screen readers, Braille displays, ... Java 2DTM API (Java 2 Platform only) Drag and Drop (Java 2 Platform only) Between Java applications and native applications.
  • 5. Each picture shows the same program but with a different look and feel javax.swing.plaf.metal.MetalLookAndFeel javax.swing.plaf.motif.MotifLookAndFeel Javax.swing.plaf.windows.WindowsLookAn dFeel
  • 6. import javax.swing.UIManager; static setLookAndFeel() method that is defined in the UIManager class. This method can throw an exception of ClassNotFoundException if the look-and-feel class cannot be found, For example: try {  UIManager.setLookAndFeel(“com.sun.java.swing.plaf.motif.MotifL ookAndFeel”); } catch(Exception e) {  System.err.println(“Look and feel not set.”); }
  • 7. UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for( UIManager.LookAndFeelInfo look : looks) System.out.println(look.getClassName()); Java Default Look And Feel UIManager.setLookAndFeel ( UIManager.getCrossPlatformLookAndFeel());
  • 8. Swing provides many standard GUI components such as buttons, lists, menus, and text areas, which you combine to create your program's GUI. Swing provides containers such as a window. top level: frames, dialogs intermediate level: panel, scroll pane, tabbed pane, ... View Components
  • 9. Descendents of the java.awt.Container class Components that can contain other components. Use a layout manager to position and size the components contained in them. Components are added to a container using one of the various forms of its add method Depending on which layout manager is used by the container panel.add(component);
  • 10.
  • 11. Every program that presents a Swing GUI contains at least one top-level container. A Top level container provides the support that Swing components need to perform their painting and event-handling. Swing provides four top-level containers: JFrame (Main window) JDialog (Base For Dialogs) JApplet (An applet display area within a browser window) JWindow (Secondary Display Devices)
  • 12.
  • 13. To appear on screen, every GUI component must be part of a containment hierarchy, with a top-level container as its root. Each top-level container has a content pane that contains visible components in that top-level container’s GUI. A top-level container can not contain another top level container.
  • 14.
  • 15. A frame implemented as an instance of the JFrame class, is a window that has decorations such as a border, a title and buttons for closing and iconifying the window. Applications with a GUI typically use at least one frame.
  • 16.
  • 17. import javax.swing.*; public class HelloWorldSwing { public static void main(String[] args) { JFrame frame = new JFrame("HelloWorldSwing"); final JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); // 1.4 // OR USE THIS frame.add(label); JDK 5 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
  • 18.
  • 19.
  • 20.
  • 21. Position (x,y) Name .setName() .getName(); Size Foreground And Background Color Font Cursor State (setEnabled ([True/False])) isEnable() Visible (setVisible([True/False])) isVisible() Valid isValid()
  • 22. Position is defined by x and y coordinates of type int, or by an object of type java.awt.Point. Size is defined by width and height, also values of type int, or by an object of type java.awt.Dimension. A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's upper-left point (x,y) in the coordinate space, its width, and its height.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. The decorations on a frame are platform dependent. A JApplet object has the same arrangement of panes as a JFrame object. Window class and its subclasses, as objects of type Window (or of a subclass type) can’t be contained in another container.