Home Java Java-tips GUI Q Fill-in: Rainfall GUI

Ask Questions?

View Latest Questions


 
 

Fill-in: Rainfall GUI
Posted on: July 26, 2006 at 12:00 AM
About the Rainfall GUI

Java Notes

Fill-in: Rainfall GUI

Name ______________________________

  1. (5 points) Make a drawing of approximately what the window that this generates looks like someplace on this page.
  2. (15 points) Fill in the blanks in this program. Each blank represents ONE keyword, variable, operator, etc.

The RainfallGUI2 class

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
 35 
 36 
 37 
 38 
 39 
 40 
 41 
 42 
 43 
 44 
 45 
 46 
 47 
 48 
 49 
 50 
 51 
 52 
 53 
 54 
 55 
 56 
 57 
 58 
 59 
 60 
 61 
 62 
 63 
 64 
 65 
 66 
 67 
 68 
 69 
 70 
 71 
 72 
 73 
 74 
 75 
 76 
 77 
 78 
 79 
 80 
 81 
 82 
 83 
 84 
// RainfallGUI2.java - Provides a GUI interface to the RainfallStats class.

import javax._______________.*;
import java.awt.*;
import java.awt.event.*;

public class RainfallGUI2 _______________ JFrame {
    
    //================================================ my instance variables
    private RainfallStats _rainLogic;  // Keeps data, calculates statistics.
    
    private JTextField _averageTF      = new JTextField(4);
    private JTextField _numberTF       = new JTextField(4);
    private JTextArea  _rainfallDataTA = new JTextArea(5, 20);
    private JTextField _totalTF        = new JTextField(4);
    // End of variables declaration
    
    //============================================================= constructor
    public _______________() {
        //... Set up the model / logic
        _rainLogic = new RainfallStats(500);  // Room for 500 data points.
        
        JButton calcStatsBtn = new _______________("Calculate Statistics");
        calcStatsBtn._______________(new BtnListener());
        
        //============================================================= layout
        //... Result Panel
        JPanel resultPanel = new _______________();
        resultPanel._______________(new GridLayout(3, 2, 5, 5));
        resultPanel.add(new JLabel("Total"));
        resultPanel.add(_totalTF);
        resultPanel.add(new _______________("Number"));
        resultPanel.add(_numberTF);
        resultPanel.add(_______________ JLabel("Average"));