CSci 2101 Data Structures: Lab 14: Java applets

Java Applets

Some helpful APIs:

For full credit it's enough to do just the first problem.

Problem 1

Draw an applet with some shapes and your name on it.

Problem 2

Your task is to write an applet that draws a picture which looks roughly like this:

Use methids fillArc() and drawArc() methods of the Graphics class to draw the umbrellas.

Here are some hints on setting the text:
The method drawString of the Graphics package writes text.

Changing your font
To liven up your font a bit (otherwise it will appear in the default font), you can set the font for the graphics object just as you set color for drawing, only instead of setColor() you use setFont() (see the Graphics contract). Changing your font requires creating a new Font object. The Font constructor takes 3 parameters:

In this lab, the font in the applet was created like this:

Font rainfont =	new Font("Serif", Font.BOLD, 20);

This is a lab from CSci 2101 course.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.