NetBeans Java Applet Development Guide

This document introduces Java Applet development in Netbeans, including creating Applet class and HTML document, running Applet in Netbeans, etc.


NetBeans Java Applet Development Guide - cover page
Brand
NetBeans
Category
Programming
Document type
Programming Manual
Language
ID
Pages
24
File format
PDF
File size
557 KB
Published
01 November, 2023
Updated
01 November, 2023
MD5 checksum
970EBDF45FCA5DA33B831BE33BA17465

About this manual

This Indonesian-language guide explains how to create and run Java Applets in the NetBeans IDE. It describes the two basic steps - developing an Applet class based on the java.applet package and creating an associated HTML document - and provides template code for both the Applet class and the HTML embedding page.

Step-by-step instructions cover creating an applet file via File > New File (Java category, Applet/JApplet file type), compiling it to a .class file, and running it to generate the HTML page. Worked examples include Applet1 (drawing a red circle), Applet2 (a moving ball using threads and the Runnable interface), Applet3 (random circles drawn on mouse clicks), and Applet3.1, which adds double-buffering so previous circles remain. The guide also explains how to change the applet size by editing the HTML file in the src folder rather than the build folder, where it is overwritten on each run.

What's inside

  • Applet template
  • HTML template
  • How to create an applet in NetBeans
  • Compiling and running the applet
  • Application 1: Applet1.java
  • Application 2: Applet2.java
  • Application 3: Applet3.java
  • Changing the applet size
  • Application 3.1: double-buffering

Frequently asked questions

What are the two steps to create a Java Applet?

First create an Applet class, then create an HTML document associated with that Applet class to run it at a set size on a web page.

How do I create a new applet file in NetBeans?

Open File > New File, choose the Java category, and select the Applet or JApplet file type; the file is saved in the src folder.

Why does my edited applet HTML in the build folder keep reverting?

The HTML file in the build folder is overwritten every time the file is run. Copy it to the src folder, edit it there, and rebuild so it is copied back to build.

How does the Applet2 example make the ball move?

It implements the Runnable interface, declares a Thread object, starts the thread in start(), and moves the ball inside the run() function with repaint() calls.

Download PDF (557 KB)