第18章applet和多媒体.pptVIP

  • 2
  • 0
  • 约1.75万字
  • 约 55页
  • 2017-02-06 发布于重庆
  • 举报
第18章applet和多媒体

* Case Study: Bouncing Ball, cont. Ball BallControl BounceBallApp Run * What is Multimedia? Multimedia is a broad term that encompasses making, storing, retrieving, transferring, and presenting various types of information, such as text, graphics, pictures, videos, and sound. Multimedia involves a complex weave of communications, electronics, and computer technologies. It is beyond the scope of this book to cover multimedia in great detail. This chapter concentrates on the presentation of multimedia in Java. Whereas most programming languages have no built-in multimedia capabilities, Java was designed with multimedia in mind. It provides extensive built-in support that makes it easy to develop powerful multimedia applications. Javas multimedia capabilities include animation that uses drawings, audio, and images. Optional * The URL Class Audio and images are stored in files. The .URL class can be used to identify the files on the Internet. In general, a URL (Uniform Resource Locator) is a pointer to a resource on the World Wide Web. A resource can be something as simple as a file or a directory. You can create a URL object using the following constructor: ? public URL(String spec) throws MalformedURLException ? For example, the following statement creates a URL object for : ? try { URL url = new URL(); } catch(MalformedURLException ex) { } ? Optional * Creating a URL for Local Files The following statement creates a URL object for the file c:\book\image\us.gif. ? try { URL url = new URL(c:\\book\\image\\us.gif); } catch(MalformedURLException ex) { } ? The preceding statement creates a URL for the absolute file name c:\book\beep.au on the Windows. There are two problems: (1) the file location is fixed; (2) it is platform-dependent. To circumvent these problems, you can create the URLs for files using through the resource of the class file using the java.lang.Class class. * Creating a URL from a Class Reference Whenever the Java Virtual Machine loads a class o

文档评论(0)

1亿VIP精品文档

相关文档