SlideShare a Scribd company logo
1 of 14
MAINA MARY NJOKI
CT204/109390/22
TABLE OF CONTENT
 Details for fxml in java
 Event listeners in java
 Implementation of a)inheritance
 b)polymorphism
FXML
 FXML is an XML based language used to design the view/ layout/
interface for the user interface of a JavaFX GUI application.
 It breaks up the view of the project and organizes it.
 It’s similar to HTML as they are both used in designing applications,
only difference is that FXML is used to store and transport data while
HTML is used to display the data.
CONTROLLER CLASS
 A controller class is normally a class that basically controls the flow of the
data, whose object is created by FXML.
 The primary purpose of the controller class is to handle the logic of the user
interface defined in the FXML file. It is also used for;
 Handling events
 Accessing User Interface elements
 Initialization
 Data binding
An example of a corresponding java controller class
 package com.example;
 import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.scene.control.Button;
 public class MyController {
 @FXML
 private Button button;
 @FXML
 private void handleButtonClick(ActionEvent event) {
 System.out.println("Button clicked!");
 }
 }
In this Java class:
 The ‘@FXML’ annotation is used to inject the ‘Button’ defined in the FXML file into
the controller class
 The ‘handleButtonClick’ method is annotated with ‘@FXML’ and is specified in the
FXML file as the method to be called when the button is clicked.
These two files together demonstrate a simple example of using FXML to define
the structure of a JavaFX user interface and a corresponding controller class to
handle events.
EVENT LISTENERS
 Event listeners in JavaFX are used to handle various user interactions, such as button
clicks, mouse movements, key presses, and more.
 Event listeners are associated with specific GUI elements and respond to events
triggered by user actions.
 JavaFX event listeners are implemented as methods in a controller class and are often
annoted with ‘@FXML’.
Examples of event listeners
1.Button click event
 This method is associated with a button in the FXML file using the ‘6’ attribute.
@FXML
private void handleButtonClick(ActionEvent event) {
// Code to execute when the button is clicked
}
2.Mouse Click Event
 this method is associated with a GUI element in the FXML file using the ‘onMouseClicked’ attribute.
@FXML
private void handleMouseClick(MouseEvent event) {
// Code to execute when the mouse is clicked
}
3.Key press event
 It is associated with a GUI element in the FXML file using the ‘onKeyPressed’
attribute
@FXML
private void handleKeyPress(KeyEvent event) {
// Code to execute when a key is pressed
}
INHERITANCE IN JAVA
Inheritance in java enables developers to inherit data members and properties
from one class to another.
IMPORTANT TERMINOLOGY USED IN JAVA INHERITANCE
class-a set of objects which shares common behavior and properties.
Parent class/super class-the class whose features are inherited.
Child class/sub class-class that inherits other class.
Reusability-when a class needs to be created and there is already a class that
exist.
TYPES OF INHERITANCE
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Hybrid inheritance
IMPLEMENTATION OF INHERITANCE
Extends keyword is used for inheritance in java.
Using extends keyword indicates you are derived from an existing class.
Extends refers to increased functionality.
SYNTAX
Class derived-class extends base-class
{
//methods and fields
}
Implementation of inheritance in java
 }

 // Inherited or Sub Class
 class Engineer extends Employee {
 int benefits = 10000;
 }

 // Driver Class
 class Gfg {
 public static void main(String args[])
 {
 Engineer E1 = new Engineer();
 System.out.println("Salary : " + E1.salary
 + "nBenefits : " + E1.benefits);
 }
 }
POLYMORPHISM IN JAVA
 Polymorphism refers to ability to take more than one form.
 Static polymorphism
 Polymorphism that is resolved during compiler time is known as static
polymorphism

Types of Polymorphism
1) Static Polymorphism
2) Dynamic Polymorphism
Dynamic polymorphism
 It is also known as Dynamic Method Dispatch. Dynamic polymorphism is a
process in which a call to an overridden method is resolved at runtime rather,
thats why it is called runtime polymorphism.

More Related Content

Similar to mary powerpoint.pptx about IT technology

Java AWT and Java FX
Java AWT and Java FXJava AWT and Java FX
Java AWT and Java FXpratikkadam78
 
JavaFX programming
JavaFX programmingJavaFX programming
JavaFX programmingFulvio Corno
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java ProgrammingRaveendra R
 
Debugging lightning components
Debugging lightning componentsDebugging lightning components
Debugging lightning componentsMadan Khichi
 
Debugging lightning components
Debugging lightning componentsDebugging lightning components
Debugging lightning componentsMohith Shrivastava
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxkristinatemen
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in JavaGurpreet singh
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsSaurabh Narula
 
Dynamic and Generic Manipulation of Models: From Introspection to Scripting
Dynamic and Generic Manipulation of Models: From Introspection to ScriptingDynamic and Generic Manipulation of Models: From Introspection to Scripting
Dynamic and Generic Manipulation of Models: From Introspection to Scriptingvanwormhoudt
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil MughalAdil Mughal
 
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEA
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEAScala - By Luu Thanh Thuy CWI team from eXo Platform SEA
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEAThuy_Dang
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1guest38bf
 

Similar to mary powerpoint.pptx about IT technology (20)

Java AWT and Java FX
Java AWT and Java FXJava AWT and Java FX
Java AWT and Java FX
 
JavaFX programming
JavaFX programmingJavaFX programming
JavaFX programming
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Debugging lightning components
Debugging lightning componentsDebugging lightning components
Debugging lightning components
 
Debugging lightning components
Debugging lightning componentsDebugging lightning components
Debugging lightning components
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Jsf
JsfJsf
Jsf
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptx
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in Java
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
 
Books
BooksBooks
Books
 
Struts Ppt 1
Struts Ppt 1Struts Ppt 1
Struts Ppt 1
 
Dynamic and Generic Manipulation of Models: From Introspection to Scripting
Dynamic and Generic Manipulation of Models: From Introspection to ScriptingDynamic and Generic Manipulation of Models: From Introspection to Scripting
Dynamic and Generic Manipulation of Models: From Introspection to Scripting
 
C# concepts
C# conceptsC# concepts
C# concepts
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal
 
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
 
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEA
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEAScala - By Luu Thanh Thuy CWI team from eXo Platform SEA
Scala - By Luu Thanh Thuy CWI team from eXo Platform SEA
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
 
Struts 2
Struts 2Struts 2
Struts 2
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

mary powerpoint.pptx about IT technology

  • 2. TABLE OF CONTENT  Details for fxml in java  Event listeners in java  Implementation of a)inheritance  b)polymorphism
  • 3. FXML  FXML is an XML based language used to design the view/ layout/ interface for the user interface of a JavaFX GUI application.  It breaks up the view of the project and organizes it.  It’s similar to HTML as they are both used in designing applications, only difference is that FXML is used to store and transport data while HTML is used to display the data.
  • 4. CONTROLLER CLASS  A controller class is normally a class that basically controls the flow of the data, whose object is created by FXML.  The primary purpose of the controller class is to handle the logic of the user interface defined in the FXML file. It is also used for;  Handling events  Accessing User Interface elements  Initialization  Data binding An example of a corresponding java controller class
  • 5.  package com.example;  import javafx.event.ActionEvent;  import javafx.fxml.FXML;  import javafx.scene.control.Button;  public class MyController {  @FXML  private Button button;  @FXML  private void handleButtonClick(ActionEvent event) {  System.out.println("Button clicked!");  }  }
  • 6. In this Java class:  The ‘@FXML’ annotation is used to inject the ‘Button’ defined in the FXML file into the controller class  The ‘handleButtonClick’ method is annotated with ‘@FXML’ and is specified in the FXML file as the method to be called when the button is clicked. These two files together demonstrate a simple example of using FXML to define the structure of a JavaFX user interface and a corresponding controller class to handle events.
  • 7. EVENT LISTENERS  Event listeners in JavaFX are used to handle various user interactions, such as button clicks, mouse movements, key presses, and more.  Event listeners are associated with specific GUI elements and respond to events triggered by user actions.  JavaFX event listeners are implemented as methods in a controller class and are often annoted with ‘@FXML’.
  • 8. Examples of event listeners 1.Button click event  This method is associated with a button in the FXML file using the ‘6’ attribute. @FXML private void handleButtonClick(ActionEvent event) { // Code to execute when the button is clicked } 2.Mouse Click Event  this method is associated with a GUI element in the FXML file using the ‘onMouseClicked’ attribute. @FXML private void handleMouseClick(MouseEvent event) { // Code to execute when the mouse is clicked }
  • 9. 3.Key press event  It is associated with a GUI element in the FXML file using the ‘onKeyPressed’ attribute @FXML private void handleKeyPress(KeyEvent event) { // Code to execute when a key is pressed }
  • 10. INHERITANCE IN JAVA Inheritance in java enables developers to inherit data members and properties from one class to another. IMPORTANT TERMINOLOGY USED IN JAVA INHERITANCE class-a set of objects which shares common behavior and properties. Parent class/super class-the class whose features are inherited. Child class/sub class-class that inherits other class. Reusability-when a class needs to be created and there is already a class that exist. TYPES OF INHERITANCE Single inheritance Multiple inheritance Multi-level inheritance Hierarchical inheritance Hybrid inheritance
  • 11. IMPLEMENTATION OF INHERITANCE Extends keyword is used for inheritance in java. Using extends keyword indicates you are derived from an existing class. Extends refers to increased functionality. SYNTAX Class derived-class extends base-class { //methods and fields }
  • 12. Implementation of inheritance in java  }   // Inherited or Sub Class  class Engineer extends Employee {  int benefits = 10000;  }   // Driver Class  class Gfg {  public static void main(String args[])  {  Engineer E1 = new Engineer();  System.out.println("Salary : " + E1.salary  + "nBenefits : " + E1.benefits);  }  }
  • 13. POLYMORPHISM IN JAVA  Polymorphism refers to ability to take more than one form.  Static polymorphism  Polymorphism that is resolved during compiler time is known as static polymorphism  Types of Polymorphism 1) Static Polymorphism 2) Dynamic Polymorphism
  • 14. Dynamic polymorphism  It is also known as Dynamic Method Dispatch. Dynamic polymorphism is a process in which a call to an overridden method is resolved at runtime rather, thats why it is called runtime polymorphism.