How To: Run Java Applets in IntelliJ Idea

If you happen to be doing a course on outdated software like me you might encounter a need to run Java Applets inside your IDE of choice: IntelliJ Idea.

Now before I’d start I’d just like to point out that many news sites have told their readers to disable Java from running in their browsers. Guess what applets are. That’s right, Java that runs inside a browser!

The good news is, after messing around for a bit, I worked out how to code them in IntelliJ Idea anyway.

Step 1

Screen Shot 2013-02-27 at 9.46.14 AM

Open IntelliJ Idea and hit ‘Create New Project’

Step 2

Make a new Java Module and give it a name, the rest of the settings can be left as default.

Screen Shot 2013-02-27 at 9.47.31 AM

Hit ‘Finish’

 

Step 3

Create a new Java class and call it something nice by right-clicking on your ‘src’ folder > new > class

Screen Shot 2013-02-27 at 9.49.02 AM

 

Step 4

Fill in your new Java class with the base structure of an applet

Screen Shot 2013-02-27 at 9.51.48 AM

/**
 * Created with IntelliJ IDEA.
 * Author:
 * Date  : 27/02/13
 * Time  : 9:50 AM
 */
import java.applet.Applet;
import java.awt.*;

public class Main extends Applet{

    public void paint (Graphics g) {
        // Code goes here
    }

}

GG, almost there.

 

Step 5

Tell IntelliJ Idea you want to make an applet by right-clicking on the new class you created and selecting Create ‘Your_Class_Name’ …

Screen Shot 2013-02-27 at 9.55.13 AM

 

Step 6

All the settings can be left as they are, you can optionally change the width & height options to change the size of your Applet’s default window.

Screen Shot 2013-02-27 at 9.56.52 AM

Click ‘OK’

 

Step 7

This isn’t really a step, you’re done.

Simply hit the play/run/triangle button to run your code and launch your applet (it’ll be blank until you put some code in of course).

Screen Shot 2013-02-27 at 9.59.33 AM

Something’s wrong

I later encountered issues using this method when trying to get images, etc to display/work. If you’re experiencing the same problems you might want to try this tutorial as well: http://valk.id.au/blog/free-stuff/help-applets-are-behaving-weird-in-intellij-idea/

28 Replies to “How To: Run Java Applets in IntelliJ Idea”

  1. You are fantastic! I spent the last hour going through the settings trying to get this to run, and now its seamless. Stupid outdated java course!

  2. Hello friends!
    I am an official representative of private company which deals with all kinds of written work (essay, coursework, dissertation, presentation, report, etc) in short time.
    We are ready to offer a free accomplishment of written work hoping for further cooperation and honest feedback about our service.
    This offer has limited quantities!!!
    Details on our website: >>> top-stud.biz

  3. Wonderful goods from you, man. I’ve understand
    your stuff previous to and you’re just extremely great.

    I really like what you have acquired here, really like what you are saying and the way in which
    you say it. You make it enjoyable and you still care for to keep
    it smart. I can’t wait to read far more from you. This is really a wonderful website.

  4. Attractive part of content. I just stumbled upon your blog and
    in accession capital to assert that I get actually loved account your weblog posts.
    Any way I’ll be subscribing to your feeds and even I success you get right of entry to persistently fast.

  5. Обратите внимание!!!
    Реально полезная штука.
    С помощью этого средства можно восстанавливать любые кожаные изделия.
    Всегда пригодится в хозяйстве.
    уход за кожей

  6. I’d must check with you here. Which is not something I generally do! I delight in reading a post that can make people think. Also, thanks for allowing me to comment!

  7. You are absolutely correct, I would like to find out new info on this particular topic! I am also captivated by Arvind Pandit since I believe it is quite cool at the moment. Keep doing this!

Leave a Reply

Your email address will not be published. Required fields are marked *