SlideShare una empresa de Scribd logo
1 de 11
Architecture Dependent /* My first C program. */ #include <stdio.h> Main() { Printf(“Hello World!”); } Platform  independent  C source code C compiler for Sun Solaris C compiler for Windows C compiler for Mac OS C compiler for  Linux Compilation Yields 10010110011101101001010101001010 10110101011001010111010101111101 01010100101010101011101010001001 10101011110011101000101001011100 Platform specific binary code
Java Architecture Neutral // My first Java program.  public class HelloWorld { public static void main (String[ ] args) { System.out.println(“Hello World!”);  } } Platform  independent  java source code Compilation Yields E po 3/4 -     () V  ([Ljava/lang/String;)V <init> Code HelloWorld HelloWorld.java…………. Platform independent byte code A platform DEPENDENT JVM running on the underlying Hardware  architecture 101010010100100101001010010010100011010001010010001000001001010001010010 Binary code java compiler for Sun Solaris java compiler for  Windows Java compiler for  Mac OS Java compiler for  Linux
Hierarchical diagram Dimension Font FontMetrics Color Graphics Component LayoutManager Container Panel Window Applet Frame Dialog JApplet JFrame JDialog JComponent 1 ** Classes in the  java.awt package  Swing Components in the  javax.swing package  HeavyWeight  LightWeight
JComponent and its subclasses AbstractButton JTextComponent JMenuItem JButton JToggleButton JEditorPane JTextField JTextArea JCheckBoxMenuItem Jmenu JRadioButtonMenuItem JCheckBox JRadioButton JPasswordField JLabel JList JComboBox JMenuBar JPanel JOptionPane JScrollBar JScrollPane JFileChooser JPopupMenu JProgressBar JInternalFrame JSeparator JToolbar JToolTip JSlider JSplitPane JLayeredPane JTabbedPane JTable JTableHeader JRootPane JTree JPane JColorChooser JComponent
EventObject Class AWTEvent ListSelectionEvent ActionEvent AdjustmentEvent ComponentEvent ItemEvent TextEvent ContainerEvent FocusEvent InputEvent PaintEvent WindowEvent EventObject MouseEvent KeyEvent
Event Registration, Listening and Handling Register a Listener object Source Object Event Object Event Handler Listener Object Trigger an Event Generate an Event Generate an Event An event triggered by user actions on the source objects. The source object generates the event object and invokes the handler of the listener object to process the event. User action
Graphical user interface: Application Frame Pull-down Menus A frame can contain menus, panels, and user interface components. Panels can contain other panels. Panel Panel Panel UI Panel UI Panel UI Panel UI User Interface Components (UI)
Graphical user interface: Applet Applet Pull-down Menus A frame can contain menus, panels, and user interface components. Panels can contain other panels. Panel Panel User Interface Component Panel User Interface Component Panel Panel Panel User Interface Component Panel Panel User Interface Component Panel User Interface Component Panel Panel User Interface Component Panel Panel
UserAction, SourceObject and EventType MouseEvent Component Mouse pressed, released, moved, clicked, entered, or exited KeyEvent Component Key released or pressed ListSelectionEvent JList Select Item(s) AdjustmentEvent JScrollBar Move the scroll bar WindowEvent Window Window open, close,closing, iconified,de-iconified ContainerEvent Container Component added/removed ComponentEvent Component Component moved, resized, hidden or shown  TextEvent JTextComponent Change text FocusEvent Component Component gained or lost focus ItemEvent, ActionEvent JRadioButton Click a radio button ItemEvent, ActionEvent JCheckBox Click a check box ItemEvent, ActionEvent JComboBox Select a new item ActionEvent JMenuItem Select menu item ActionEvent JTextField <cr> on a text field ActionEvent JButton Click a button Event Type generated Source Object User Action
Events, EventListener and Listener Methods componentMoved(ComponentEvent e) componentHidden(ComponentEvent e) componentResized(ComponentEvent e) componentShown(ComponentEvent e) ComponentListener ComponentEvent componentAdded(ContainerEvent e) componentRemoved(ContainerEvent e) ContainerListener ContainerEvent focusGained(FocusEvent e) focusLost(FocusEvent e) FocusListener FocusEvent keyPressed(KeyEvent e) keyReleased(KeyEvent e) keyTyped(KeyEvent e) KeyListener KeyEvent adjustmentValueChanged (AdjustmentEvent e) AdjustmentListener AdjustmentEvent textValueChanged(TextEvent e) TextListener TextEvent itemStateChanged(ItemEvent e) ItemListener ItemEvent ActionPerformed(ActionEvent e) ActionListener ActionEvent Listener Methods (handlers) Listener Interface Event Class
Events, EventListener and Listener Methods windowClosing(WindowEvent e) windowOpened(WindowEvent e) windowIconfied(WindowEvent e) windowDeIconified(WindowEvent e) windowClosed(WindowEvent e) windowActivated(WindowEvent e) windowDeactivated(WindowEvent e) WindowListener WindowEvent mousePressed(MouseEvent e) mouseReleased(MouseEvent e) mouseEntered (MouseEvent e) mouseExited (MouseEvent e) mouseClicked (MouseEvent e) mouseDragged (MouseEvent e) mouseMoved (MouseEvent e) MouseListener MouseMotionListener MouseEvent Listener Methods (handlers) Listener Interface Event Class

Más contenido relacionado

Destacado

Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWTbackdoor
 
High Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC ClustersHigh Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC ClustersSaliya Ekanayake
 
Java event processing model in c# and java
Java  event processing model in c# and javaJava  event processing model in c# and java
Java event processing model in c# and javaTech_MX
 
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...AboutYouGmbH
 
Core java lessons
Core java lessonsCore java lessons
Core java lessonsvivek shah
 

Destacado (6)

Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
 
High Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC ClustersHigh Performance Data Analytics with Java on Large Multicore HPC Clusters
High Performance Data Analytics with Java on Large Multicore HPC Clusters
 
Java event processing model in c# and java
Java  event processing model in c# and javaJava  event processing model in c# and java
Java event processing model in c# and java
 
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 

Similar a 01 Java Is Architecture Neutral

Chapter11 graphical components
Chapter11 graphical componentsChapter11 graphical components
Chapter11 graphical componentsArifa Fatima
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptsharanyak0721
 
SWING USING JAVA WITH VARIOUS COMPONENTS
SWING USING  JAVA WITH VARIOUS COMPONENTSSWING USING  JAVA WITH VARIOUS COMPONENTS
SWING USING JAVA WITH VARIOUS COMPONENTSbharathiv53
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5sotlsoc
 
Synapseindia dotnet development chapter 14 event-driven programming
Synapseindia dotnet development  chapter 14 event-driven programmingSynapseindia dotnet development  chapter 14 event-driven programming
Synapseindia dotnet development chapter 14 event-driven programmingSynapseindiappsdevelopment
 
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in JavaBasic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Javasuraj pandey
 
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2PRN USM
 
Java gui event
Java gui eventJava gui event
Java gui eventSoftNutx
 
ITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptxITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptxudithaisur
 
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
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in javaGoogle
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892renuka gavli
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024nehakumari0xf
 

Similar a 01 Java Is Architecture Neutral (20)

Swing_Introduction.ppt
Swing_Introduction.pptSwing_Introduction.ppt
Swing_Introduction.ppt
 
Chapter11 graphical components
Chapter11 graphical componentsChapter11 graphical components
Chapter11 graphical components
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.ppt
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
SWING USING JAVA WITH VARIOUS COMPONENTS
SWING USING  JAVA WITH VARIOUS COMPONENTSSWING USING  JAVA WITH VARIOUS COMPONENTS
SWING USING JAVA WITH VARIOUS COMPONENTS
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
 
Synapseindia dotnet development chapter 14 event-driven programming
Synapseindia dotnet development  chapter 14 event-driven programmingSynapseindia dotnet development  chapter 14 event-driven programming
Synapseindia dotnet development chapter 14 event-driven programming
 
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in JavaBasic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
 
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
 
Swing
SwingSwing
Swing
 
Java gui event
Java gui eventJava gui event
Java gui event
 
14a-gui.ppt
14a-gui.ppt14a-gui.ppt
14a-gui.ppt
 
ITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptxITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptx
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in java
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892
 
GUI Programming with Java
GUI Programming with JavaGUI Programming with Java
GUI Programming with Java
 
Gu iintro(java)
Gu iintro(java)Gu iintro(java)
Gu iintro(java)
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
 

Último

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 Scriptwesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.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...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

01 Java Is Architecture Neutral

  • 1. Architecture Dependent /* My first C program. */ #include <stdio.h> Main() { Printf(“Hello World!”); } Platform independent C source code C compiler for Sun Solaris C compiler for Windows C compiler for Mac OS C compiler for Linux Compilation Yields 10010110011101101001010101001010 10110101011001010111010101111101 01010100101010101011101010001001 10101011110011101000101001011100 Platform specific binary code
  • 2. Java Architecture Neutral // My first Java program. public class HelloWorld { public static void main (String[ ] args) { System.out.println(“Hello World!”); } } Platform independent java source code Compilation Yields E po 3/4 -   () V  ([Ljava/lang/String;)V <init> Code HelloWorld HelloWorld.java…………. Platform independent byte code A platform DEPENDENT JVM running on the underlying Hardware architecture 101010010100100101001010010010100011010001010010001000001001010001010010 Binary code java compiler for Sun Solaris java compiler for Windows Java compiler for Mac OS Java compiler for Linux
  • 3. Hierarchical diagram Dimension Font FontMetrics Color Graphics Component LayoutManager Container Panel Window Applet Frame Dialog JApplet JFrame JDialog JComponent 1 ** Classes in the java.awt package Swing Components in the javax.swing package HeavyWeight LightWeight
  • 4. JComponent and its subclasses AbstractButton JTextComponent JMenuItem JButton JToggleButton JEditorPane JTextField JTextArea JCheckBoxMenuItem Jmenu JRadioButtonMenuItem JCheckBox JRadioButton JPasswordField JLabel JList JComboBox JMenuBar JPanel JOptionPane JScrollBar JScrollPane JFileChooser JPopupMenu JProgressBar JInternalFrame JSeparator JToolbar JToolTip JSlider JSplitPane JLayeredPane JTabbedPane JTable JTableHeader JRootPane JTree JPane JColorChooser JComponent
  • 5. EventObject Class AWTEvent ListSelectionEvent ActionEvent AdjustmentEvent ComponentEvent ItemEvent TextEvent ContainerEvent FocusEvent InputEvent PaintEvent WindowEvent EventObject MouseEvent KeyEvent
  • 6. Event Registration, Listening and Handling Register a Listener object Source Object Event Object Event Handler Listener Object Trigger an Event Generate an Event Generate an Event An event triggered by user actions on the source objects. The source object generates the event object and invokes the handler of the listener object to process the event. User action
  • 7. Graphical user interface: Application Frame Pull-down Menus A frame can contain menus, panels, and user interface components. Panels can contain other panels. Panel Panel Panel UI Panel UI Panel UI Panel UI User Interface Components (UI)
  • 8. Graphical user interface: Applet Applet Pull-down Menus A frame can contain menus, panels, and user interface components. Panels can contain other panels. Panel Panel User Interface Component Panel User Interface Component Panel Panel Panel User Interface Component Panel Panel User Interface Component Panel User Interface Component Panel Panel User Interface Component Panel Panel
  • 9. UserAction, SourceObject and EventType MouseEvent Component Mouse pressed, released, moved, clicked, entered, or exited KeyEvent Component Key released or pressed ListSelectionEvent JList Select Item(s) AdjustmentEvent JScrollBar Move the scroll bar WindowEvent Window Window open, close,closing, iconified,de-iconified ContainerEvent Container Component added/removed ComponentEvent Component Component moved, resized, hidden or shown TextEvent JTextComponent Change text FocusEvent Component Component gained or lost focus ItemEvent, ActionEvent JRadioButton Click a radio button ItemEvent, ActionEvent JCheckBox Click a check box ItemEvent, ActionEvent JComboBox Select a new item ActionEvent JMenuItem Select menu item ActionEvent JTextField <cr> on a text field ActionEvent JButton Click a button Event Type generated Source Object User Action
  • 10. Events, EventListener and Listener Methods componentMoved(ComponentEvent e) componentHidden(ComponentEvent e) componentResized(ComponentEvent e) componentShown(ComponentEvent e) ComponentListener ComponentEvent componentAdded(ContainerEvent e) componentRemoved(ContainerEvent e) ContainerListener ContainerEvent focusGained(FocusEvent e) focusLost(FocusEvent e) FocusListener FocusEvent keyPressed(KeyEvent e) keyReleased(KeyEvent e) keyTyped(KeyEvent e) KeyListener KeyEvent adjustmentValueChanged (AdjustmentEvent e) AdjustmentListener AdjustmentEvent textValueChanged(TextEvent e) TextListener TextEvent itemStateChanged(ItemEvent e) ItemListener ItemEvent ActionPerformed(ActionEvent e) ActionListener ActionEvent Listener Methods (handlers) Listener Interface Event Class
  • 11. Events, EventListener and Listener Methods windowClosing(WindowEvent e) windowOpened(WindowEvent e) windowIconfied(WindowEvent e) windowDeIconified(WindowEvent e) windowClosed(WindowEvent e) windowActivated(WindowEvent e) windowDeactivated(WindowEvent e) WindowListener WindowEvent mousePressed(MouseEvent e) mouseReleased(MouseEvent e) mouseEntered (MouseEvent e) mouseExited (MouseEvent e) mouseClicked (MouseEvent e) mouseDragged (MouseEvent e) mouseMoved (MouseEvent e) MouseListener MouseMotionListener MouseEvent Listener Methods (handlers) Listener Interface Event Class