Mortgage
Essay by review • November 22, 2010 • Study Guide • 849 Words (4 Pages) • 1,539 Views
==================================================================
Main Program File Name: mortgage4.java
Programming Language: Java
Main Project Programmer:
Program Version: 1.2
Version Control: 1.2
===================================================================*/
/* BEGIN PROGRAM */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
public class mortgage4 extends JFrame implements ActionListener
{
int term = 0;
double principal = 0;
double rate = 0;
double monthlyPayment = 0;
double interest = 0;
//***************Create JPanels and Make JLabels and JTextFields***************
JPanel row1 = new JPanel();
JLabel mortgage_label = new JLabel("My Mortgage Calculator", JLabel.CENTER);
JPanel row2 = new JPanel(new GridLayout(1, 2));
JLabel principal_label = new JLabel("Mortgage Principal $",JLabel.LEFT);
JTextField principal_txt = new JTextField(10);
JPanel row3 = new JPanel(new GridLayout(1, 2));
JLabel term_label = new JLabel("Mortgage Term (Yrs)",JLabel.LEFT);
JTextField term_txt = new JTextField(10);
JPanel row4 = new JPanel(new GridLayout(1, 2));
JLabel rate_label = new JLabel("Interest Rate (%)", JLabel.LEFT);
JTextField rate_txt = new JTextField(10);
JPanel row5 = new JPanel(new GridLayout(1, 2));
JLabel payment_label = new JLabel("Monthly Payment $", JLabel.LEFT);
JTextField payment_txt = new JTextField(10);
JPanel row6 = new JPanel(new GridLayout(1, 2));
JLabel autofill_label = new JLabel("Auto Fill", JLabel.LEFT);
//***************Create JButtons and FlowLayout***************
JPanel button = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
JButton clearButton = new JButton("Clear");
JButton exitButton = new JButton("Exit");
JButton calculateButton = new JButton("Calculate");
JButton amortizeButton = new JButton("Amortize Payments");
JButton loan01Button = new JButton("Loan_#01");
JButton loan02Button = new JButton("Loan_#02");
JButton loan03Button = new JButton("Loan_#03");
//***************Create JTextArea and JScrollPane***************
JTextArea displayArea = new JTextArea(10, 45);
JScrollPane scroll = new JScrollPane(displayArea);
public mortgage4()
{
//************Provide a Super Class and Title for Program*************************
}
//************Create JMenuBar and Populate it with Commands***************
public JMenuBar createMenuBar()
{
//***************Create JMenuBar***************
JMenuBar mnuBar = new JMenuBar();
setJMenuBar(mnuBar);
//***************Create JMenuBar add File***************
JMenu mnuFile = new JMenu("File", true);
mnuFile.setMnemonic(KeyEvent.VK_F);
mnuFile.setDisplayedMnemonicIndex(0);
mnuBar.add(mnuFile);
//***************Create JMenuBar add File & Exit***************
JMenuItem mnuFileExit = new JMenuItem("Exit");
mnuFileExit.setMnemonic(KeyEvent.VK_F);
...
...