How to Create a new Java Applet in Netbeans

First create a new project. Make sure you select “Java Application” not Desktop Application or other types.

On the left hand of the screen you should see “Source Packages” and your project name in lower case underneath. If you don’t see this in the little window on the left, expand the coffee icon with your project name.


Right click your package (mine is javafileuploader in the screenshot above) and select New->Java Class.

Make sure your new class is selected, and then referencing my code snippet below, import java.applet.* and java.awt.* then add new functions for “paint” and “init”.

(code snippet courtesy of ehow link in references)

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package javafileuploader;

import java.applet.*;
import java.awt.*;

 * @author fedora
public class NewClass extends Applet {
int m_height, m_width;

public void paint(Graphics m) {
for (int i=0; i<10; ++i)m.drawLine(m_width,m_height,i*m_width/10,0);

public void init() {

Once you have this typed/pasted in, select run->file and voila! you should see a little applet window appear with a green background and oblique lines. You’re now ready to begin. Enjoy!



About Ronnie Diaz

Ronnie Diaz is a software engineer and tech consultant. Ronnie started his career in front-end and back-end development for companies in ecommerce, service industries and remote education. This work transitioned from traditional desktop client-server applications through early cloud development. Software included human resource management and service technician workflows, online retail e-commerce and electronic ordering and fulfillment, IVR customer relational systems, and video streaming remote learning SCORM web applications. Hands on server experience and software performance optimization led to creation of a startup business focused on collocated data center services and continued experience with video streaming hardware and software. This led to a career in Amazon Prime Video where Ronnie is currently employed, building software and systems which stream live sports and events for millions of viewers around the world.

Posted on November 30, 2012, in Programming & Development and tagged , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: