import java.awt.*;import javax.swing.*;/** * Generates a number of random shapes of random sizes and colors as specified * by the user. * * @author Phil Brodeur * @version Nov 22 05 */public class NameWriter extends JApplet{ private String name; /** * Constructor for objects of class NameWriter */ public NameWriter() { } /** * Runs automatically when applet is run * Gets data from the user * * @param none * @return void */ public void init() { // Get data from users (as strings) name = JOptionPane.showInputDialog("Enter your name:"); } /** * Paint the ovals and rectangles on the canvas * Run after init is completed * * @param g Graphics * @return none */ public void paint( Graphics g) { super.paint(g); // Call the superclass version of paint g.drawString(name, 10, 30); }}