lecture10

lecture10 - Information Technology for Industrial Engineers...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Information Technology for Industrial Engineers 15 November 2001 http://www-classes.usc.edu/engr/ise/582 1 ISE 582: Information Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 10 JAVA Cup 9: Images, Interactive Forms 15 November 2001 Information Technology for IEs 2 Lecture 10 slides Chapter 47 ( pp 305-311 ) Chaper 49 ( pp 325-339 ) Homework 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Information Technology for Industrial Engineers 15 November 2001 http://www-classes.usc.edu/engr/ise/582 2 15 November 2001 Information Technology for IEs 3 JAVA Cup 8 Adding Images to Applets Creating Forms and Firing Events 15 November 2001 Information Technology for IEs 4 Adding Images to Applets Move Image Files into Applets Define Subclass of JComponent Display Images (in paint method) using drawImage (from Graphics class) Modify other parts of program
Background image of page 2
Information Technology for Industrial Engineers 15 November 2001 http://www-classes.usc.edu/engr/ise/582 3 15 November 2001 Information Technology for IEs 5 The Parts MovieApplication MovieAuxiliaries MovieDataInterface, MovieData , MovieDataObserver MovieListListener MovieInterface, Movie , MovieObserver MeterInterface, Meter , MeterListener PosterInterface, Poster 15 November 2001 Information Technology for IEs 6 The Poster Interface public interface PosterInterface { // Setter public abstract void setImageFile (String fileName); }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Information Technology for Industrial Engineers 15 November 2001 http://www-classes.usc.edu/engr/ise/582 4 15 November 2001 Information Technology for IEs 7 The Poster Class Itself import java.awt.*; import javax.swing.*; import java.util.*; public class Poster extends JComponent implements PosterInterface { private String file ; private Image image ; public void setImageFile (String s) { ... } public void paint (Graphics g) { ... } public Dimension getMinimumSize () {return new Dimension(200, 300);} public Dimension getPreferredSize () {return new Dimension(200, 300);} } 15 November 2001 Information Technology for IEs 8 Remember… public static Image readMovieImage (String fileName) { try { URL url = MovieAuxiliaries.class . getResource (fileName); if (url == null) {return null;} ImageProducer producer = (ImageProducer) (url.getContent()); if (producer == null) {return null;} Toolkit tk = Toolkit.getDefaultToolkit(); Image image = tk. createImage (producer); return image; } catch (IOException e) {System.out.println(e);}; return null; } Auxili aries
Background image of page 4
Information Technology for Industrial Engineers 15 November 2001 http://www-classes.usc.edu/engr/ise/582 5 15 November 2001 Information Technology for IEs 9 The DrawImage Method Defined in Graphics class An instance method Arguments specify the image, the origin, the dimensions and the component Usage: g. drawImage (image,x,y,width,height,component) 15 November 2001 Information Technology for IEs 10 Poster class: setImageFile method public void setImageFile (String s) { if (s != file) { file = s; if (file == null) { image = null; } else { image = MovieAuxiliaries. readMovieImage (file); } repaint(); } }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Information Technology for Industrial Engineers
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/01/2009 for the course ISE 582 taught by Professor Chew during the Fall '03 term at USC.

Page1 / 22

lecture10 - Information Technology for Industrial Engineers...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online