Preloading Images for better Performance Using the MediaTracker class.

Slides:



Advertisements
Similar presentations
#8: Try it Out on Users, Then Fix It! Users bring a different context to the situation than do designers (thumbnail plot images provided as a reminder.
Advertisements

Html: getting started HTML is hyper text markup language. It is what web browsers look at on the Internet. HTML documents should be created in a simple.
Linking Your Web Pages Together. Links… index.htmunit4.htm Evaluation of web graphics GIF vs. JPEG Web photo album To link the lines in index.htm to the.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 3.
Homework Any Questions?. Statements / Blocks, Section 3.1 An expression becomes a statement when it is followed by a semicolon x = 0; Braces are used.
Introduction to Computers and Programming Lecture 9: For Loops New York University.
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 Images. Drawing images Java can display.gif,.jpg (or.jpeg ), and.png images These are the only kinds it can display Displaying them is (relatively)
Fonts And Image. Fonts To display text, we choose a font. Recall that we are dealing with pixels in graphics programming. To choose a font, we need to.
CSE 341, S. Tanimoto Java networking- 1 Java Networking Motivation Network Layers Using Sockets A Tiny Server Applets URLs Downloading Images, MediaTracker.
GUI Tutorial Images. Useful Info – not on final exam.
Taking Pictures Sec 9-9 Web Design. Objectives The student will: Know how command the scribbler robot to take a picture. Know how to display the picture.
August 7,  FileNet Aduiting  FileNet Disk Encryption  FileNet Java Warning  HTML 5 FileNet Viewer Update  ILINX Capture Update and Demo.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Threads and Multimedia Animation, Images, Sound. Animation nAnimation, displaying a sequence of frames to create the illusion of motion, is a typical.
(c) 2008 E.S.Boese All Rights Reserved. Threads and Media Chapter 8 - Lecture Slides 1.
PROGARMMING THROUGH JAVA Presentation on IMAGES Group No:3 Presented By: Anthony Narzary (DC2012MCA0002) Chandra Gupta Bora (DC2012MCA0009) Dipankar Saikia.
Java Programming, Second Edition Chapter Seventeen Multithreading and Animation.
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.
CSE 219 Computer Science III Images. HW1 Has been posted on Blackboard Making a Game of Life with limited options.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
Unit 1 – Improving Productivity Instructions ~ 100 words per box.
 7 seconds  55%  38%  7%  Avoid lots of typing onto your slides – it is very boring and distracting for the audience. They should be listening.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 BUILDING JAVA PROGRAMS CHAPTER 6 FILE PROCESSING.
(c)2009 by E.S. Boese. All Rights Reserved. Classes Chapter 13 – Lecture Slides 1 Got class?
CSC1401 Classes - 1. Learning Goals Computing concepts Identifying objects and classes Declaring a class Declaring fields Default field values.
1 Learning objectives By the end of this chapter you should be able to:  explain how concurrency is achieved by means of time-slicing;  distinguish between.
Chapter 6 Applets and HTML  Overview  HTML tags for Applets  Applet Life Cycle  Applet Class  JAR files.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Review of Graphics in Java,
12/5/00SEM107, Kamin & ReddyReview - 34 Events Event types Catching different event types Getting information from components and events Distinguishing.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Java Programming Working with Sound and Images. Topics Learn about the paint() and repaint() methods Learn about paintComponent() method Use the drawString()
Exam / Homework Exam 1 Starting K&R chapter 4 tonight
Chapter 16 Multimedia F Audio Files F Playing Audio F Running Audio on a Separate Thread F Displaying Images F Displaying a Sequence of Images  Using.
Computer Science I Classes and objects Classwork/Homework: Examine and modify my examples. Make your own.
1 Features of Java (2) CS 3331 Sections 4.5 and 4.6.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Today: –Review declaration, implementation, simple class structure. –Add an exception class and show.
CompSci Introduction to Jam’s Video Game Package.
Slide 1 Graphics (Characteristics 1) Images have various characteristics that affect performance Size (number of pixels) – Large images can be several.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
STEPS IN CHOOSING A TOPIC [TopicPreparation.pptx] FOR PAPERS THAT ARE: LITERARY ARGUMENTATIVE/PERSUSIVE POSITION EXPOSITORY.
Get Going On ….. Load the word file ‘Glossary’ and complete it. You will have homework today.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Java Applets Adding Animation. Import Files You still need to include the same files: –import java.applet.*; –import java.awt.*;
Introduction to Arrays. Learning Objectives By the end of this lecture, you should be able to: – Understand what an array is – Know how to create an array.
Mike Mulhearn & Drew Hobbs IMAGE ICON.  Paints icons from images  Images can be JPEG, JPG, GIF, PNG, BMP, WBMP  Images may also be created from a URL,
Adapted from Slideshow-Presentation-Without-Being-a-Pro.
Chapter 14: Multimedia Audio Files Audio Files Playing Audio Playing Audio Running Audio on a Separate Thread Running Audio on a Separate Thread Displaying.
Creating an Object that can draw itself The paint method can ‘draw’ because it is passed a graphics environment as a parameter. If a class method is passed.
Optical Flow walk through Aidean Sharghi Spring 14.
Image from
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
DS.H.1 Hashing Chapter 5 Overview The General Idea Hash Functions Separate Chaining Open Addressing Rehashing Extendible Hashing Application Example: Geometric.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
Introduction to Matlab
CSE 341, S. Tanimoto Java networking-
What is the average rate of change of the function f (x) = 8 x - 7 between x = 6 and x = 7? Select the correct answer:
Using local variable without initialization is an error.
TOSCA-Metadata (directory )
Graphics (Characteristics 1)
TOSCA-Metadata (directory )
Homework Any Questions?.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Java Tutorial – Application Building
February , 2009 CSE 113 B.
A Programming Language for
Presentation transcript:

Preloading Images for better Performance Using the MediaTracker class

Introduction If your applet uses a lot of images, all of them may not be able to load fast enough As a result you might get half-images If you use the MediaTracker class to preload all your images you can avoid this problem

In the variable section MediaTracker tracker; Image pic,pic2; declare a MediaTracker object Declare all the images you are going to use Dont for get to put them in the same directory as your.class file

In the init() method Besides all the other initializations you need for you program you should call a separate method you will make to do the image initializations eg: –initImages();

In the initImages() method public void initImages() { tracker=new MediaTracker(this); pic=getImage(getCodeBase(),"spaceship.gif"); tracker.addImage(pic,0); pic2=getImage(getCodeBase(),"spaceship2.gif"); tracker.addImage(pic2,1); //load rest of the images in the same way try {tracker.waitForAll();} catch(InterruptedException e) {} } initialize the MediaTracker object load an image as before add the image to the tracker index of the images in the tracker These lines try to catch any errors in loading the images