Java Applet Notes Cleaned
Java Applet Notes Cleaned
- Applets are small programs designed to run in a web browser or an applet viewer.
- Divided into:
3. Types of Applets
- Remote Applets: Hosted on a remote server, downloaded and run via the internet.
4. Advantages of Applets
5. Drawbacks of Applets
- Applets:
- Applications:
- Initialization (init()):
- Running (start()):
- Idle/Stopped (stop()):
- Called when the applet is paused, e.g., user navigates away from the page.
- Dead/Destroyed (destroy()):
- Steps:
- Graphics Class:
- drawString(String text, x, y)
- Color Class:
- setBackground(Color.RED)
- Font Class:
- g.setFont(f);
- Cannot access the file system or communicate with servers other than the host.
- Write and compile the applet Java file (HelloJava.java -> HelloJava.class).
- Create an HTML file with the <APPLET> tag referencing the .class file.
- Test using:
- A Java-enabled browser.
These notes provide a comprehensive overview of Java applets, suitable for reference or study.