updated: February 3, 2011
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.
Difficulty: ModerateInstructions1Open a new file in your Java integrated development environment or your favored text editor. Remember to create the file name with the .java extension.
2Import 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.
3Create 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.
4Create 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.
5Create 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.
6Add a mouse motion listener. This object will track the mouse around the whiteboard. Use the syntax "addMouseMotionListener( this );" to do this.
7Create the events for when the mouse is clicked. Follow the form of:[your draw function name](MouseEvent e) {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.
8Compile your code into a class file. Turn the code into an applet by using the "<APPLET = [your whiteboard program].class> </APPLET>" HTML tag.
mac iphone ringtone maker




