SlideShare a Scribd company logo
1 of 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

More Related Content

Viewers also liked

Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
backdoor
 
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
Saliya 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 java
Tech_MX
 

Viewers also liked (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 to 01 Java Is Architecture Neutral

Chapter11 graphical components
Chapter11 graphical componentsChapter11 graphical components
Chapter11 graphical components
Arifa Fatima
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
sotlsoc
 
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
PRN USM
 
ITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptxITE 1122_ Event Handling.pptx
ITE 1122_ Event Handling.pptx
udithaisur
 
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
 

Similar to 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
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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
 
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)
 
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...
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 

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