Question: /* An applet shell Anderson, Franceschi */ import java.awt.Color; import java.awt.Graphics; import java.awt.Polygon; import javax.swing.JApplet; public class ShellApplet extends JApplet { public void paint(Graphics g)

/* An applet shell Anderson, Franceschi */

import java.awt.Color; import java.awt.Graphics; import java.awt.Polygon; import javax.swing.JApplet;

public class ShellApplet extends JApplet {

public void paint(Graphics g) { super.paint(g);

// Student code starts here:

// Student code ends here. }

}

Programming Activity 4-1 Guidance ================================= Required items -------------- As stated in the textbook activity, your drawing must include at least: 2 rectangles 2 ovals 2 circle 2 lines 1 polygon 3 colors (with one being a custom color) 1 text label Required positioning technique ------------------------------ You must use relative positioning. Declare and initialize starting x and y coordinates. Use offsets from these values to code all figure positions. The last video on relative positioning takes this a step further. It shows you how to have more than one base point, if you want. Running the applet ------------------ You will run your applet in the JDK applet viewer, not in a web browser. TextPad's command to run an applet (Ctrl+3) runs your applet in the JDK applet viewer. The videos explain this. Use an html page with an applet tag to define your applet's window size. Control the layout ------------------ You can make your applet window whatever dimensions you decide. You do this via the HTML page's width and height attribute values. Make sure your starting x and y coordinates, combined with your shape offsets, do not cause parts of your drawing to disappear beyond the viewing area. Window size ----------- The maximum x and y values depend on the width and height attribute values set in the applet tag in the html page. Coordinate system ----------------- In a traditional math coordinate system, y values increase as you move up. In the Java graphics coordinate system: The origin is in the upper left corner of the viewing window. y values increase as you move down. Negative coordinates are off the visible screen area to the left or above. Other applet methods -------------------- You do not need to include the init(), start(), stop(), and destroy() applet functions. You only need to have a paint method as shown in the book and the videos. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!