/* * File: PrimesApplet.java * Author: Java Java Java Staff * Description: This class provides a GUI to the Primes class. The user inputs * an integer N into a TextField, and this applet prints all the prime numbers * between 1 and N. */ import java.applet.*; import java.awt.*; import java.awt.event.*; public class PrimesApplet extends Applet implements ActionListener { private Label prompt; // The GUI components private TextField inputField; private TextArea outputArea; private Primes primesTester = new Primes(); // The Primes expert /** * findPrimes() is a private helper method. It uses a Primes object * to find the prime numbers between 1 and its parameter. * @param num -- a positive integer */ private void findPrimes (int num) { outputArea.setText(""); // Clear the output area //Insert your code here } // findPrimes() /** * init() sets up the applet's GUI. */ public void init() { //Insert your code here } // init() /** * actionPerformed() whenever the user types Enter in the inputField. * It reads the user's input, converts it to an integer and * passes it to the findPrimes() method. */ public void actionPerformed(ActionEvent e) { //Insert your code here } // actionPerformed() } // PrimesApplet