1 inf160 is development environments aubg, cos dept lecture 04 title: computer applications (extract...
TRANSCRIPT
![Page 1: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/1.jpg)
1
INF160 IS Development Environments AUBG, COS dept
Lecture 04Title:
Computer Applications (Extract from Syllabus)
![Page 2: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/2.jpg)
2
Lecture Contents:
Program – definition/description Application – definition/descriptionCategories of applicationsDemo programs/applications
![Page 3: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/3.jpg)
3
Demo Programs:
Group name: Test160aHelloWorldConsole Applications:
Test160aHelloWorldVBTest160aHelloWorldCPPTest160aHelloWorldC#Test160aHelloWorldJava
![Page 4: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/4.jpg)
4
Demo Programs:
Group name: Test160eGUI1GUI Applications:
Test160eGUI1VBTest160eGUI1CPPTest160eGUI1C#Test160eGUI1Java
![Page 5: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/5.jpg)
5
Demo Programs:
Group name: Test160eGUI2GUI Applications:
Test160eGUI2VBTest160eGUI2CPPTest160eGUI2C#Test160eGUI2Java
![Page 6: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/6.jpg)
6
Demo Programs:
Group name: Test160eGUI3GUI Applications: Java Applets
Test160eGUI3Java
![Page 7: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/7.jpg)
7
Program – definition/description
Program: An organized list of instructions that, when executed, causes the computer to behave in a predetermined manner.
A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. The variables can represent numeric data, text, or graphical images.
Without programs, computers are useless.
![Page 8: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/8.jpg)
8
Application – definition/description
Application: A program or a group of programs designed for end users.
Application software can be divided into two general classes: Systems software Application software.
for details, open next 2 slides
![Page 9: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/9.jpg)
9
Application – definition/description
Systems software consists of low-level programs that interact with the computer at a very basic level. This includes:
Operating Systems components,
Compilers or Language Processors,
Uutilities for managing computer resources.
![Page 10: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/10.jpg)
10
Application – definition/description
In contrast, application software (also called end-user programs) includes:
Data Base programs, Word processors,Spreadsheets etc.Figuratively speaking, applications software
sits on top of systems software because it is unable to run without the operating system and system utilities.
![Page 11: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/11.jpg)
11
![Page 12: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/12.jpg)
12
Enterprise application
Enterprise application, or
Enterprise software, or
Enterprise Application Software (EAS) are all commonly used phrases i.e. synonyms to describe applications -- or software -- that a business would use to assist the organization in solving enterprise problems.
![Page 13: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/13.jpg)
13
Categories of applications – primitive elementary classified
Console Applications
Windows GUI Applications
Web based (Internet) Applications
![Page 14: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/14.jpg)
14
Categories of applications – more precise classification
Most IDEs come with a package of wizards that generate starting code for wide variety of applications
Console ApplicationsWindows GUI ApplicationsWeb based (Internet) ApplicationsServicesClass librariesOther special applications
![Page 15: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/15.jpg)
15
Categories of applications – more precise classification
Console Applications Run in a command prompt And are text – only Reading from the keyboard Writing to the screen
![Page 16: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/16.jpg)
16
Categories of applications – more precise classification
Windows GUI Applications Are graphical applications Use mouse and keyboard for generating events Use Windows controls such as labels, text boxes,
buttons, check boxes, radio buttons etc.
![Page 17: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/17.jpg)
17
Categories of applications – more precise classification
Web based (Internet) Applications Run on a Web server When a particular URL is loaded Send HTML as response to a request from a
waiting browser
![Page 18: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/18.jpg)
18
Categories of applications – more precise classification
Services Applications that run in the background And respond to requests But have no any visual user interface
![Page 19: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/19.jpg)
19
Categories of applications – more precise classification
Class libraries Are collections of code that can be called by other
code. Static libraries (.lib, .a) Dynamic libraries (.dll)
![Page 20: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/20.jpg)
20
You can create several different types of programs using C#.
For example,
•.NET console application running on Windows.
•.NET graphical user interface (GUI) application running on Windows (desktop applications).
•ASP.NET web application running on Internet Information Services (IIS).
![Page 21: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/21.jpg)
21C# Programming: From Problem Analysis to Program Design 21
Types of Applications Developed with C#
Web applications
Windows graphical user interface (GUI) applications
Console-based applications
Class libraries and stand-alone components (.dlls)
Smart device applications
Services
![Page 22: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/22.jpg)
22C# Programming: From Problem Analysis to Program Design 22
Types of Applications Developed with Java
Java programs may be applications or applets.
Applications are standalone programs, similar to .NET Console applications and/or Windows based GUI applications.
Applets are similar to applications, but they do not run as standalone programs.
- Instead, applets adhere to a set of conventions that lets them run within a Java-compatible browser (client-side).
- You can only run an applet from an HTML page.
![Page 23: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/23.jpg)
2323Java Programming: From Problem Analysis to Program Design, 4e
INTRO to Graphical User Interface (GUI) Components
Computing Process models I P O Client Server
JAVA I-P-O Applications classified: Console applications
• Input data, output data displayed in MSDOS window Windowed applications
• Using dialog boxes for input/output (class JOptionPane and methods) Windows based GUI applications
• Using Swing class library components: windows, labels, text fields, buttons etc.
![Page 24: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/24.jpg)
2424Java Programming: From Problem Analysis to Program Design, 4e
INTRO to Graphical User Interface (GUI) Components
Drawbacks/disadvantages of Console applications Dialog boxes based windowed applications
Suppose, the user/developer wants the program to display all input data and output data in one pane or window or dialog box
Java calls such a dialog box GUI or simply UI
![Page 25: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/25.jpg)
2525Java Programming: From Problem Analysis to Program Design, 4e
Graphical User Interface (GUI) Components
Advantages of using GUI: View inputs and outputs simultaneously One graphical window Input values typed in any order Change input values in window Click on buttons to get output
![Page 26: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/26.jpg)
2626Java Programming: From Problem Analysis to Program Design, 4e
Graphical User Interface (GUI) Components
Terminology:Frame
Title bar• System supported icons
• Title Content pane
• Components – labels, text fields, buttons etc
![Page 27: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/27.jpg)
27
Web based (Internet) Applications
C
![Page 28: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/28.jpg)
28
Web Applications
C# Programming: From Problem Analysis to Program Design 28
Figure 1-14 Web application written using C#
![Page 29: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/29.jpg)
29C# Programming: From Problem Analysis to Program Design 29
Web Applications (continued)
C# was designed with the Internet applications in mind
Can quickly build applications that run on the Web with C#
Using Web Forms: part of ASP.NET
![Page 30: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/30.jpg)
30
Windows GUI Applications
C
![Page 31: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/31.jpg)
31C# Programming: From Problem Analysis to Program Design 31
Windows Applications
Applications designed for the desktop
Designed for a single platform
Use classes from System.Windows.Form
Applications can include menus, pictures, drop-down controls, buttons, text boxes, and labels
Use drag-and-drop feature of Visual Studio
![Page 32: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/32.jpg)
32C# Programming: From Problem Analysis to Program Design 32
Windows Applications (continued)
Figure 1-15 Windows application written using C#
![Page 33: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/33.jpg)
33
Console Applications
C
![Page 34: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/34.jpg)
34C# Programming: From Problem Analysis to Program Design 34
Console Applications
Normally read input data from the keyboard
Display text on the command console
Easiest to create
Simplest approach to learning software development
Minimal overhead for input and output of data
![Page 35: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/35.jpg)
35
Demo Programs:
Console Applications:
![Page 36: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/36.jpg)
36
Demo Programs:
Group name: Test160aHelloWorldConsole Applications:
Test160aHelloWorldVB Source text Demo execution
![Page 37: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/37.jpg)
37
Demo Programs:
Group name: Test160aHelloWorldConsole Applications:
Test160aHelloWorldCPP
![Page 38: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/38.jpg)
38
Demo Programs:
Group name: Test160aHelloWorldConsole Applications:
Test160aHelloWorldC#
![Page 39: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/39.jpg)
39
Demo Programs:
Group name: Test160aHelloWorldConsole Applications:
Test160aHelloWorldJava
![Page 40: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/40.jpg)
40
Demo Programs:
GUI Applications:
![Page 41: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/41.jpg)
41
Demo Programs:
Group name: Test160eGUI1GUI Applications:
Test160eGUI1VBTest160eGUI2VB
![Page 42: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/42.jpg)
42
Demo Programs:
Group name: Test160eGUI1GUI Applications:
Test160eGUI1CPPTest160eGUI2CPP
![Page 43: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/43.jpg)
43
Demo Programs:
Group name: Test160eGUI1GUI Applications:
Test160eGUI1C#Test160eGUI2C#
![Page 44: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/44.jpg)
44
Demo Programs:
Group name: Test160eGUI1GUI Applications:
Test160eGUI1JavaTest160eGUI2Java
![Page 45: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/45.jpg)
45
Java Demo Programs:
GUI Applications:
Pure empty frame displayed
PureFrame.java
![Page 46: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/46.jpg)
46
Java Demo Programs:
GUI Applications:
Frame includes: 3 labels, 3 text boxes, 2 buttons
Proben14.java
![Page 47: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/47.jpg)
47
Demo Programs:
JAVA Applets:
![Page 48: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/48.jpg)
48
Demo Programs:
Group name: Test160eGUI3GUI Applications: Java Applets
Test160eGUI3Java
![Page 49: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/49.jpg)
49
Demo Programs:
Applets:
Pure empty frame displayed using AppletViewer utility
WelcomeApplet.java
![Page 50: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/50.jpg)
50
Demo Programs:
Applets:
Pure empty frame displayed using Web browser utility
WelcomeApplet.javaWelcomeApplet.html
![Page 51: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/51.jpg)
51
Demo Programs:
Applets:
Frame includes 2 labels, 2 textfields and displayed using AppletViewer utility
TempConvertApplet.java
![Page 52: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/52.jpg)
52
Demo Programs:
Applets:
Frame includes 2 labels, 2 textfields and displayed using Web browser utility
TempConvertApplet.javaTempConvertApplet.html
![Page 53: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/53.jpg)
53
Thank You For
Your Attention!
![Page 54: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/54.jpg)
54Java Programming, Fifth Edition 54
Introducing Applets
Applets Java programs called from within another
application Frequently run from a Web page Display as rectangular area Can respond to user-initiated events Behaviors come from Java class named JApplet
![Page 55: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/55.jpg)
55Java Programming, Fifth Edition 55
Introducing Applets (continued)
Similar to Java application .java file extension Compile into bytecode using the javac command Saved with .class extension Can contain:
• Methods you define
• Variables and constants
• Decisions, loops, and arrays
• GUI elements
![Page 56: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/56.jpg)
56
Introducing Applets (continued)
Different from a Java application Descend from the JApplet class Run from another application
• Do not use the java command to execute an applet Do not contain a main() method Do not set a default close operation Cannot delete, read, or create files on the user’s system Cannot run any other program on the user’s system
Java Programming, Fifth Edition 56
![Page 57: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/57.jpg)
57
Understanding the JApplet Class
Import JApplet import javax.swing.JApplet;
JApplet Swing class
Skeletal structure of a typical Applet
Java Programming, Fifth Edition 57
import java.awt.Graphics;import javax.swing.JApplet;public class WelcomeApplet extends JApplet{
}
![Page 58: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/58.jpg)
58
Running an Applet
Run applet from a document usually in HTMLHTML, or Hypertext Markup Language
Simple language used to create Web pages for the Internet Contains many commands
Run an applet In a Web browser Applet Viewer
•appletviewer command
Java Programming, Fifth Edition 58
![Page 59: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/59.jpg)
59Java Programming, Fifth Edition 59
Writing an HTML Documentto Host an AppletWhen you create an applet
Write applet in Java• Save with .java file extension
Compile applet into bytecode using javac command Write HTML document
• Includes statement to call compiled Java class Load HTML document into a Web browser
• Or run Applet Viewer program
![Page 60: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/60.jpg)
60Java Programming, Fifth Edition 60
Writing an HTML Documentto Host an Applet (continued)Web browser
Program allows display of HTML documents Often contains Java applets
Untrusted code Carries possibility of doing harm Applet code not trusted
Sandbox Safe area in which applet code can run
![Page 61: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/61.jpg)
61Java Programming, Fifth Edition 61
Writing an HTML Documentto Host an Applet (continued)Run applet from within HTML document
<HTML>
<object code="AClass.class" width=300 height=200> </object>
</HTML>
Three object tag attributes code
• Name of compiled applet width height
![Page 62: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/62.jpg)
62Java Programming, Fifth Edition 62
Writing an HTML Documentto Host an Applet (continued)
Pixels Control size of applet Set with width and height Tiny dots of light
• Make up image on video monitor
Tag set <applet> and </applet> Use instead of <object> tag Better to use <object> tag
![Page 63: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/63.jpg)
63Java Programming, Fifth Edition 63
Creating a JApplet Containingan init() Method
JApplet class methods Invoked by Web browser when browser runs applet public void init() public void start() public void paint() public void stop() public void destroy()
![Page 64: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/64.jpg)
64
Creating a JApplet Containingan init() Method (continued)
Java Programming, Fifth Edition 64
![Page 65: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/65.jpg)
65Java Programming, Fifth Edition 65
Understanding the JAppletLife Cycle
Applets are popular Easy to use in Web pages
JApplet class Contains methods automatically called by browser
•init()•start()•stop()•destroy()
![Page 66: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/66.jpg)
66Java Programming, Fifth Edition 66
Understanding the JAppletLife Cycle (continued)
init() method Executes when Web page containing a JApplet
loaded Or when running appletviewer command
start() method Executes after init() method Executes again every time applet becomes active
after it has been inactive
![Page 67: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/67.jpg)
67Java Programming, Fifth Edition 67
Understanding the JAppletLife Cycle (continued)
stop() method Invoked when user leaves Web page
destroy() method Called when user closes browser or Applet Viewer Releases any resources JApplet might have
allocated
Every JApplet has the same life cycle outline
![Page 68: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/68.jpg)
68
Understanding the JAppletLife Cycle (continued)
Java Programming, Fifth Edition 68
![Page 69: 1 INF160 IS Development Environments AUBG, COS dept Lecture 04 Title: Computer Applications (Extract from Syllabus)](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649e9e5503460f94b9f61f/html5/thumbnails/69.jpg)
69Java Programming: From Problem Analysis to Program Design, 4e 69
Differences Between Applets and GUI Applications
Applets Class extends JApplet No main method Uses init method Displayed by HTML Sets title in HTML Size set in HTML Applet closes when HTML
doc closes
GUI applications class extends JFrame Invokes main method Uses constructors Uses method setVisible Uses setTitle method Uses method setSize Closes with Exit button