Gui Mortgage Calculator - Basic
Below is one of our free research papers on Gui Mortgage Calculator - Basic. If the term paper below is not exactly what you're looking for, you can search our essay database for other topics or order a custom essay.
Gui Mortgage Calculator - Basic
/*
* Author:
* Class:
* File Name:
* Assignment:
*
* This program allows a user to calculate a mortgage payment based on their input.
* The input consists of the loan amount, length of the loan, and the interest rate.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.io.*;
// Sets the Mortgage1 class which allows a user to calculate a mortgage loan
public class Mortgage1 extends JFrame {
// Creates the buttons that will be used
private JButton calcButton = new JButton("Calculate");
private JButton resetButton = new JButton("Reset");
// Creates the labels for the fields to be used
private final JLabel amountLabel = new JLabel("Loan Amount:");
private final JLabel termLabel = new JLabel("Term (in years):");
private final JLabel rateLabel = new JLabel("Rate (actual %):");
private final JLabel mpayLabel = new JLabel("Monthly Payment:");
// Creates the text fields for the user input
private JTextField amountField;
private JTextField termField;
private JTextField rateField;
private JTextField mpayField;
// Adds the title to the window and defines window diminsions
public Mortgage1() {
super("PRG/421 Mortgage Calculator");
initComponents();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(275, 175);
setVisible(true);
setResizable(false);
setLocationRelativeTo(null);
MenuBar mnuBar = new MenuBar();
setMenuBar(mnuBar);
Menu mnuFile = new Menu("File", true);
mnuBar.add(mnuFile);
MenuItem mnuFileExit = new MenuItem("Exit");
mnuFile.add(mnuFileExit);
Menu mnuHelp = new Menu("Help", true);
mnuBar.add(mnuHelp);
MenuItem mnuAbout = new MenuItem("About");
mnuHelp.add(mnuAbout);
mnuFileExit.addActionListener(new ExitMenuHandler());
//mnuFileExit.setActionCommand("Exit");
}
// Creates the actual buttons and fields in a usable way
public void initComponents() {...
- Submitted by: CuriousStudent
- Date Submitted: 09/07/2009 09:46 AM
- Category: Technology
- Words: 460
- Pages: 2
- Views: 101
- Rank: 23410