Download presentation
Presentation is loading. Please wait.
Published byNeil Morris Modified over 9 years ago
1
1
2
At the end of this slide, student able to: Applet & Advanced Graphic Learn how the Web browser controls and executes the applet Learn how to handle mouse events and keystrokes Multimedia, input & output Develop multimedia applications with audio and images. Understand input and output streams 2
3
3 Applet is file that can used as Graphical User Interface (GUI) inside webpage.
4
4 1. Install jxpiinstall.exe and set as medium security 2. Create New project (to create applets file) 3. Create new java inside that project and clean & debug (to create.jar file) package javaapplication5; import javax.swing.*; public class JavaApplication5 extends JApplet{ public JavaApplication5() { add(new JLabel("Great!", JLabel.CENTER)); } 4. Create New project (to create html file) 5. Copy.jar file and paste into current project. 6. Create html file: Java Applet Demo 7. Open html file using firefox.
5
5
6
6 package javaapplication8; // DataInputStream, DataOutputStream, IOException /* * TestDataStream.java * * $Id:$ * * $Log:$ */ /* * A sample program that works with the DataStream classes * and demonstrates Binary I/O * * @author Liang-16.8 */ import java.io.*;// DataInputStream, DataOutputStream, IOException public class JavaApplication8 { public static void main(String args[]) throws IOException { // Create data output stream DataOutputStream output = new DataOutputStream(new FileOutputStream("temp.dat")); // Write out some data output.writeUTF("John"); output.writeDouble(85.5); output.writeUTF("Jim"); output.writeDouble(185.5); output.writeUTF("George"); output.writeDouble(105.25); // Close the output stream output.close(); // Create data input stream for the file DataInputStream input = new DataInputStream(new FileInputStream("temp.dat")); // Print student scores for (int i=0; i<3; i++) { System.out.println(input.readUTF() + " " + input.readDouble()); } // Close the input stream input.close(); } // main } // TestDataStream
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.