import javax.swing.Timer; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class Exercise18_10 extends JApplet { public Exercise18_10() { add(new TemperatureHistogram(), BorderLayout.CENTER); } // Main method public static void main(String[] args) { // Create a frame JFrame frame = new JFrame( "Exercise18_10: Temperature Histogram"); // Create an instance of the applet Exercise18_10 applet = new Exercise18_10(); // Add the applet instance to the frame frame.add(applet, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Invoke init() and start() applet.init(); applet.start(); // Display the frame frame.setSize(500, 180); frame.setLocationRelativeTo(null); // Center the frame frame.setVisible(true); } } class TemperatureHistogram extends JPanel { private double temperature[] = new double[24]; private boolean firstTime = true; private double newTemp; private int current = 23; private int interval, width, individualWidth, height; public TemperatureHistogram() { for (int i=0; i