IB103 Week 9 Free Standing Programs Chapter 18. Applets vs. Applications Applications are free standing See Program “Greeting” which prints out Hello.

Slides:



Advertisements
Similar presentations
F27SB2 Software Development 2 Lecture 2: Java GUIs 1.
Advertisements

Event Handling Feb 14, Event Model Revisited zRecall that a component can fire an event. zEach type of event is defined as a distinct class. zAn.
More Advanced AWT Last week, you learned about Applets, Lists, and Buttons AWT provides several other “widgets” and tools: –Labels –Choice boxes –Check.
Event Handling. In this class we will cover: Basics of event handling The AWT event hierarchy Semantic and low-level events in the AWT.
OOP & JAVA. HelloWorld.java /** * The HelloWorld class is an application that * displays "Hello World!" to the standard output. */ public class HelloWorld.
Events ● Anything that happens in a GUI is an event. For example: – User clicks a button, presses return when typing text, or chooses a menu item ( ActionEvent.
For IST410 Students only Events-1 Event Handling.
Unit 12 Object-oriented programming: Event-driven programming for GUI Jin Sa.
More design patterns The ADAPTER Pattern Actions and the COMMAND Pattern Actions and the COMMAND Pattern The FACTORY METHOD Pattern The PROXY Pattern The.
OOP Java1 Event Handling Overview Listeners, Adapters and Event Sources Inner classes Event Handling Details Applets and GUI Applications Event.
Java Overview February 4, /4/2004 Assignments Due – Homework 1 Due – Reading and Warmup questions Project 1 – Basic Networking.
Java 212: Interfaces Intro to UML Diagrams. UML Class Diagram: class Rectangle +/- refers to visibility Color coding is not part of the UML diagram.
Intermediate Java1 An example that uses inner classes Week Four Continued.
1 lecture 12Lecture 13 Event Handling (cont.) Overview  Handling Window Events.  Event Adapters Revisited.  Introduction to Components and Containers.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 16 Event-Driven Programming.
Chapter 10: Inheritance and Polymorphism
1 Inner classes Reading for these lectures: Weiss, Section 15.1 (Iterators and nested classes), Section 15.2 (Iterators and inner classes). A nested class.
Chapter 11: Inheritance and Polymorphism Java Programming: Program Design Including Data Structures Program Design Including Data Structures.
3461 Sequential vs. Event-driven Programming Reacting to the user.
Applets  The Applet Class  The HTML Tag F Passing Parameters to Applets.
More Event Handling Adapters Anonymous Listeners Pop menus Validating User Input.
Programming Concept Chapter I Introduction to Java Programming.
Copyright © 2002, Systems and Computer Engineering, Carleton University Gui1.ppt * Object-Oriented Software Development Part 18 Building.
Applet in Java Abhishek Singh. Advantage of Applet There are many advantages of applet. They are as follows : It works at client side so less response.
1 1. About Swing 2. The Applet Framework 3. A first Applet 4. Swing Applications 5. The Swing Event model 6. Containment hierarchies 7. Swing Taxonomy.
Graphics in Java CS 21b. The paint() Method Method in a visual component that specifies what that component looks like Particularly important for applets,
Pravin Yannawar, DOCS, NMU Jalgaon. Basic Java : Event handling in AWT and Swing 2 Objectives of This Session Explain the Event handling mechanism & demonstrate.
Introduction to GUI Programming with Java Graphical User Interfaces With AWT and Swing Towson University *Ref:
Event Handling. Event Driven Programming Flow of programs is determined by events. The Operating system recognizes events and passes them to the particular.
Network Optimization Expert Team A JAVA Program for International Arbitrage He Zhang EnvironmentTopics aroseScope and purposeOverview and structureMy.
Anonymous Classes An anonymous class is a local class that does not have a name. An anonymous class allows an object to be created using an expression.
Ch13 Creating windows and applets. Short overview AWT (Abstract Windowing Toolkit) Early Java development used graphic classesEarly Java development used.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
Java Programming: From Problem Analysis to Program Design, 3e Chapter 11 Inheritance and Polymorphism.
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Architectural Patterns Support Lecture Patterns Pattern: A representation of a proven solution. Problem Applicable Forces Solution Consequences Benefits.
Chapter 4© copyright Janson Industries More GUI ▮ Events, Actions, and Listeners ▮ The Visual Editor ▮ More GUI component properties Non-graded assg.
Event-Driven Programming CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
The UML Notations Networking LAB OOSD 담당조교 석사과정 이정환 Kyung Hee University.
1 IM103 Wk 7 (C&K ch14, p323) Abstraction, inheritance and interfaces Learning objectives By the end of this lecture you should be able to:  explain the.
Institute of Ambient Intelligence 2009, Choi, Namseok, Dongseo Univ., Java 기초 ( 컴포넌트와 이벤트 처리 프로그래밍 ) Choi,
CSI 3125, Preliminaries, page 1 Event Handling. CSI 3125, Preliminaries, page 2 Event Handling An Event Change in the state of an object is known as event.
Mouse Events GUI. Types of Events  Below, are some of the many kinds of events, swing components generate. Act causing EventListener Type User clicks.
Event Handling and Listeners in SWING The practice of event handling.
Sep 181 Example Program DemoTranslateEnglishGUI.java.
1CS480: Graphical User Interfaces. Dario Salvucci, Drexel University. Lecture 6: Event-Driven Programming.
TENTH LECTURE Event and listener. Events and Listeners An event can be defined as a type of signal to the program that something has happened. The event.
Java Swing and Events Chris North cs3724: HCI. Presentations nadine edwards, steve terhar Vote: UI Hall of Fame/Shame?
1 DemoBasic_v3, DemoBasic_v4 JButton JLabel. 2 Registering an ActionListener Register by invoking the following from within constructor DemoBasicFrame.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
CSC 205 Programming II Lecture 5 AWT - I.
Chapter 14 Event-Driven Programming
Welcome To java
Object-Orientated Analysis, Design and Programming
CHAPTER Reacting to the user.
Chapter 12 Event-Driven Programming
Event Handling Chapter 2 Objectives
Layout Managers Layout Manager—an object that decides how components will be arranged in a container Some types of layout managers: BorderLayout FlowLayout.
Advanced GUIs II CS Lecture
Chapter 11: Inheritance and Polymorphism
GUI Event Handling Nithya Raman.
Event-driven programming for GUI
Chapter 16 Event-Driven Programming
Graphics Programming - Frames
class PrintOnetoTen { public static void main(String args[]) {
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
Programming Graphical User Interface (GUI)
Advanced GUIs II CS Lecture
Presentation transcript:

IB103 Week 9 Free Standing Programs Chapter 18

Applets vs. Applications Applications are free standing See Program “Greeting” which prints out Hello because of the line in main: System.out.println(“Hello\n”); Application types: Input/output and windows/widgets

Greeting public class Greeting { public static void main(String[] args) { System.out.println("Hello"); }

The “main” method creates an object Public static void main(String args[ ]) { Application a = new Application( ); a.doWhatIsNeeded( );{ } } The sequence: 1. The operating system makes a static method “main” 2. Main creates an instance (an object) 3. Main invokes a method(s) as needed

Using AWT an example “Balloon” revisited “Play Balloon” example program not an applet anymore…an application version “MenuBalloon” adds menubars for – left/right and grow/shrink See Author’s web site and run examine program

PlayBalloon public class PlayBalloon extends Frame implements ActionListener, WindowListener { private Button grow, shrink, left, right; private Balloon myBalloon; public static void main(String[] args) { PlayBalloon f = new PlayBalloon(); f.setSize(500, 300); f.setVisible(true); } public PlayBalloon() {

PlayBalloon 2 public void windowClosing(WindowEvent e) { System.exit(0); } public void windowIconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { }