How to Set Up a Whiteboard With Java Applets

Written by micah mcdunnigan
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Set Up a Whiteboard With Java Applets
You can make digital whiteboards with Java applets. (Beautiful girl holding up a blank whiteboard image by Christopher Meder from

The Internet has opened a new medium for collaboration. Students and colleagues no longer have to be in the same physical location to share their ideas in multiple mediums. Among the multimedia tools that collaborators can use online is the "Whiteboard." Just as whiteboards in offices are available for throwing out ideas and write them down, Java applets can create the same tool online.

Skill level:


  1. 1

    Open a new file in your Java integrated development environment or your favoured text editor. Remember to create the file name with the .Java extension.

  2. 2

    Import the libraries you will need to use the Swing graphical tool kit for creating the interface for your whiteboard applet. These will include "java.awt." and "java.awt.event." to get all the necessary functions.

  3. 3

    Create your public class, within which you will write the rest of your code. Remember to match the name of the public class to the name of your file, excluding the ".java" extension.

  4. 4

    Create a new frame for your user interface. Remember the syntax follows the pattern "Frame [your frame object name] = new Frame('[window title]')" including your name for the frame object and the title of the window.

  5. 5

    Create any buttons you want for the interface. It is a whiteboard, so all you strictly need is a white rectangle, but you can add interface buttons and labels as you see fit. Remember to add these objects with "[your frame object name].add([your component);" until you have your interface built.

  6. 6

    Add a mouse motion listener. This object will track the mouse around the whiteboard. Use the syntax "addMouseMotionListener( this );" to do this.

  7. 7

    Create the events for when the mouse is clicked. Follow the form of:

    your draw function name {

    x = e.getX();

    y= e.getY();


    You will get the coordinates where the mouse was clicked. Invoke your preferred drawing method, and pass the "x" and "y" coordinates so your program can draw at that location as the mouse moves. Finish with the "repaint()" function to add the new lines to your applet face.

  8. 8

    Compile your code into a class file. Turn the code into an applet by using the "<APPLET = [your whiteboard program].class> </APPLET>" HTML tag.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.