For each part you will put the links in your course web page so that the applet can be run from a browser.
You will turn in complete source code for all parts of this assignment by the start of class on the due date.
Part 1 Starting with ShowFontsInFrame.java and ShowFontsFrameCanvas.java which are available in /usr/local/courses/cs4773/spring99/examples/set2 create three java classes as follows:
Part 2 Create FontsApplet2.java, FontsFrame2.java, and FontsCanvas2.java which are similar to the ones above except that
Step 2: Write a method which determines whether the a given position is inside the bounding box of one of the strings displayed, and if so determines the font used to display that string. If the mouse is pushed inside one of these bounding boxes, print a message to standard output.
Step 3: Create an interface called FontReceiver which looks like this:
import java.awt.*;
public interface FontReceiver {
public void SetFont(Font f);
}
Modify FontsFrame2.java and FontsCanvas2
so that their constructors take one parameter of type FontReceiver.
Have FontsApplet2.java implement FontReceiver and pass
itself as a parameter in the constructor of FontsFrame2.java
which in turns passes it to FontsCanvas2.
Get these to all compile.Step 4: When the mouse is pushed inside the bounding box of a string in FontsCanvas2, have it call SetFont with the appropriate font. The SetFont method in FontsApplet2 will display the string "ABC" in this font.
When everything is working, remove all of the printing to standard output.
Part 3 This part is optional and open-ended.
Copy the three classes with 2 in their names into new classes with 3 in their names. Modify them appropriately so they work together. Now modify only FontsCanvas3 so that it has a better user interface.
One of the problems with the earlier versions is that if the font size is too large, not all of the fonts can be displayed. Use your imagination to make it work better. Note that you are only allowed to modify this one class.