Computer Camp Programming Contest

Do as many of the problems below as you can. You may do them in any order you wish -- you do not need to start with the first one. For problems with several parts you may do as many parts as you wish. You may use your notes and book.

  1. Construct a web page with the following features:

  2. Write a Java applet similar to the MarqueeMessage applet on page 159 of the book. The applet in the book scrolls the message "Java Now!" across the screen. Your applet should print a different message (you may choose the message). Note that you do not need to type in all the program listed on page 159 because the Applet Wizard will do some of it for you. In this applet you need to use threads but NOT animation and no mouse events -- be sure to check the correct boxes when in step 3 of the wizard. Add the following features to the applet:

  3. Write a "scribble" applet that lets the user draw with the mouse. HINTS: You will need to use the mouseDown and mouseDrag events. This is similar to the MoveRectangle program you did in section 8 but simpler. First, you don't need all of the stuff about rectangles because you will be drawing a line here. Furthermore, you will not want to repaint your screen during the dragging of the mouse because you don't want to erase the part of the line already drawn. Hence, you need to do your drawing in the mouseDrag event. To do this you need to have the graphics object. The following code in the mouseDrag event will get the graphics object:
        Graphics g = getGraphics();
    
    Once you have the graphics object, you can call the methods for the graphics objects as usual. For example,
        g.drawRect(50, 50, 100, 100);