1 CS100J 08 November 2005: Applications and Applets Java application; How to produce a stand-alone application, to be run without using DrJava or any such.

Slides:



Advertisements
Similar presentations
Lecture 15.1 Static Methods and Variables. © 2006 Pearson Addison-Wesley. All rights reserved Static Methods In Java it is possible to declare.
Advertisements

God’s Advice to Young People
Java Applets A lab course by Dr. Junaid Ahmed Zubairi SUNY Fredonia.
Review of Java Applets Vijayan Sugumaran Decision and Information Sciences Oakland University.
1 CS100J 12 April 2007 Applications and Applets Read Chapter 16 of the text I never let my schooling interfere with my education. Mark Twain Learning makes.
18-Jun-15 Applets. 2 An applet is a program that is typically embedded in a Web page and can be run from a browser You need special HTML in the Web page.
1 Applets. 2 Motivations When browsing the Web, you frequently see the graphical user interface and animation developed using Java. These programs are.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
Chapter 14 Applets. 2 Knowledge Goals Understand the differing roles of applications and applets Understand how a browser operates Understand the role.
1 Recitation 11. Applet Applets. An applet is a Java program that is started by a browser (e.g. netscape or internet explorer) when an html file has a.
23-Jun-15 HTML. 2 Web pages are HTML HTML stands for HyperText Markup Language Web pages are plain text files, written in HTML Browsers display web pages.
CS100Lecture 181 Announcements P4 due tomorrow P5 handed out today References? Leave me a picture and a short note.
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
Chapter 3 - Introduction to Java Applets Outline 3.1Introduction 3.2Thinking About Objects 3.4A Simple Java Applet: Drawing a String 3.5Two More Simple.
28-Jun-15 Applets. 2 An applet is a program that is typically embedded in a Web page and can be run from a browser You need special HTML in the Web page.
Program Design With Methods And Graphics / Chapter 4 1 Abstract Window Toolkit.
Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
Java and Project Delivery E&CE 250 Winter 2002
Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction to Java Programming CS 21a: Introduction to Computing I First Semester,
What Have Councils Ever Done For Young People? Our Future is NOW Youth Development Conference 12 February 2015 Stuart Boyd Senior Strategy Consultant Adelaide.
Applets Chapter 17.  Java’s big splash onto the scene came in the mid 90’s. The people at Sun Microsystems had managed to work java programs into Web.
Georgia Institute of Technology Workshop for Programming And Systems Management Teachers Chapter 9 Source File Anatomy.
1 Introduction to Applets. 2 Applications Programs that execute using the java interpreter Executes in command windows.
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
HTML INTRODUCTION. What is HTML?  HTML stands for Hypertext Markup Language  Developed in 1990  Hidden code that helps us communicate with others on.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
GUI programming Graphical user interface-based programming.
INTRODUCTIO N WHAT IS THE #1 ISSUE FACING TEENS IN YOUR COMMUNITY.
1 CS100J 2 December 2008 Applications and Applets Read Chapter 16 of the text We also look at html, since we need it to use applets. Top finalists from.
HTML Structure & syntax. Introduction This presentation introduces the following: Doctype declaration HTML Tags, Elements and Attributes Sections of a.
Lec.10 + (Chapter 8 & 9) GUI Java Applet Jiang (Jen) ZHENG July 6 th, 2005.
1 Recitation 09. Applications and Applets Java applications Those who took CS100J and CS100M in fall 2003 may not have had much experience with Java applications.
1 CS Nov 2011 Applications and Applets Read Chapter 16 of the text We also look at html, since we need it to use applets. Top finalists from a real-life.
LEARNING HTML PowerPoint #1 Cyrus Saadat, Webmaster.
Rise of New Leadership Tim Nichols. Leadership Competency.
Chapter 6 Applets and HTML  Overview  HTML tags for Applets  Applet Life Cycle  Applet Class  JAR files.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
Lecture 15.1 Static Methods and Variables Static Methods In Java it is possible to declare methods and variables to belong to a class rather than.
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
Chapter 4 Applets Cop Why Applets? WWW makes huge information available to anyone with web browser. Web server send web pages and images to your.
1 GUI programming Graphical user interface-based programming Chapter G1 (pages )
1 CS November Testing/Debugging. And Applications Read chapter 14, pp. 385–401 Prelim 2 Max 100 Median 82 Mean 78.3 Min * ***************************
CSI 3125, Preliminaries, page 1 Compiling the Program.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
Living in Perilous Times “Perilous” Used Twice in the New Testament › “dangerous, furious” “Hard to bear, painful” › “Fierce” in Matthew 8:28 › Describes.
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
1 Applications & Applets Standalone applications & Java applets Peter Mozelius DSV/UCSC.
Chapter 131 Applets and HTML Chapter Objectives learn how to write applets learn to write a simple HTML document learn how to embed an applet in.
Applets, Images, and Audio Chapter 14 CSCI CSCI 1302 – Applets, Images, and Audio2 Outline Introduction The Applet Class –The init Method –The start.
Introduction to Programming. The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program.
CSC 243 – Java Programming, Spring, 2014 April 22, 2014 Week 13, JApplets.
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Applet An applet is a Java program that runs in a Web browser. An applet can be.
Fail to Honor our Parents
Writing Your Own Web Page: Using HTML and FrontPage Chapter 10.
"I see no hope for the future of our people if they are dependent on frivolous youth of today, for certainly all youth are reckless beyond words... When.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Introduction to Java Applets Will not cover Section 3.7 Thinking About Objects: Identifying.
Parenting and Sports: Drew Sanders. PARENTING AND SPORTS IN TODAY’S SOCIETY.
We also look at html, since we need it to use applets.
We also look at html, since we need it to use applets.
30 Java Applets.
The children now love luxury; they have bad manners, contempt for authority; they show disrespect for elders and love chatter in place of exercise. They.
Applets.
Introduction to Computing Using Java
Java Applets.
CS November 2010 Ragged arrays, Applets
We also look at html, since we need it to use applets.
CS100J 03 May 2005 Applications and Applets (Chapter 16 of the text)
Presentation transcript:

1 CS100J 08 November 2005: Applications and Applets Java application; How to produce a stand-alone application, to be run without using DrJava or any such IDE. Read sections 16.1 and Java applet; how to put one in an html page. Read sections 16.3 and I see no hope for the future of our people if they are dependent on frivolous youth of today, for certainly all youth are reckless beyond words.... Hesiod, 8th century BC What is happening to our young people? They disrespect their elders, they disobey their parents. They ignore the law. They riot in the streets inflamed with wild notions. Their morals are decaying. What is to become of them? Plato Children now love luxury; they have bad manners, contempt for authority; they show disrespect for elders and love chatter in place of exercise. Children are now tyrants, not the servants of their households. They no longer rise when elders enter the room. They contradict their parents, chatter before company, gobble up dainties at the table, cross their legs, and tyrannize their teachers. Attributed to Socrates by Plato The world is passing through troublous times. The young people of today think of nothing but themselves. They have no reverence for parents or old age. They are impatient of all restraint. They talk as if they knew everything, and what passes for wisdom with us is foolishness with them. As for girls, they are forward, immodest and unladylike in speech, behavior, and dress. Peter the Hermit in A.D. 1274

2 Java Application Java Application: A class that has a method declared like this: public static void main(String[] pars) { … } You have not need to learn about applications and method main yet, because DrJava has its interactions pane. In most other systems, students have to learn about this strange method main on day 0 of a course. The parameter is a String array. It is used to get values into the program when it starts.

3 Java Application public class C { … public static void main(String[] args) { … } … } > cd > dir (list of files) > java C Terminal window (can type “java C” in DrJava Interactions pane) Causes call C.main(null); to be executed

4 A method main for A4 Place in file ImageJFrame.java /** A JFrame with a picture in it, which is obtained using a dialogue window.*/ public static void main(String[] pars) { ImageJFrame ij; ij= new ImageJFrame("picture"); } In a command-line or terminal window, you can now do the following: 1.Compile the classes: javac *.java 2.Run the program: java ImageFrame compile all java files. Name of class that contains method main

5 Making a jar file In the terminal window, set to the directory that contains the.class files, do this: jar -cf nnn.jar *.class “jar” comes from “tar”, which stands for tape Archive. A format used to be able to save many files and folder in one file, since the early 1970s. Name of program to run “c”: create. “f”: a file name follows name of file to create.class files in current directory will be put in file nnnn.jar

6 Inspect a jar file This command causes the contents of file nnn.jar to be listed: jar -tvf nnn.jar Name of program to run “t”: list contents “v”: verbose “f”: a file name follows List contents of this file To get help with command jar, do simply: jar

7 Telling it which class has method main To put in jar file info about which class contains method main: jar -umf man.txt nnn.jar Name of program to run “u”: create. “m”: manifest file follows “f”: a file name follows name of file to update Manifest file man.txt contains a single line: Main-class: ImageJFrame Must have a carriage return or line feed Manifest: originally: list of passengers or an invoice of cargo for a ship. Generalized to a description of the contents of something.

8 Applet: a java program that can be called from a web page (in your browser) public class C { public static void main(String[] args) { … } } application import javax.swing.*; public class A extends JApplet{ public void init() { … } public void start() { …} public void stop() { … } public void destroy() { … } } applet Four inherited procedures: called to initialize called to start processing called to stop processing called to destroy resources (just before killing the applet)

9 An html (HyperText Markup Language) file FacultyApplet This is an Applet! <applet archive="AppletClasses.jar” code="FacultyApplet.class” width=800 height=550> tags start an html page start the “heading” the title for the page start the body, content of the page begin a paragraph begin boldface begin italics start a Java applet line break (no end tag)