2010-03-10_055929_McalcGUI4_copy

2010-03-10_055929_McalcGUI4_copy - package...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
package mortgagecalculator6; /* * Carlos Velez * SR-mf-003 Change Request 4 * PRG/421 Roland Morales * Mortgage Calculator * Week 4 IA */ //to imports necessary packages import java.awt.*; import java.awt.event.*; import java.text.*; import javax.swing.*; import javax.swing.JTextField; public class McalcGUI4 extends JFrame implements ActionListener { //to declare the different GUI elements that are going to be used JFrame loanFrame; JFrame paymentFrame; JPanel loanPanel; JPanel paymentPanel; JButton calculateButton; JButton calculate7Button; JButton calculate15Button; JButton calculate30Button; JButton resetButton; JButton quitButton; JLabel principalLabel; JLabel rateLabel; JLabel termLabel; JLabel paymentLabel; JTextField principalField; JTextField rateField; JTextField termField; JTextField paymentField; JTextArea paymentArea; JScrollPane paymentScroll; public McalcGUI4 () { JFrame loanFrame = new JFrame("Mortgage Calculator: Controls");//this builds the frame for the program controls loanFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loanFrame.setSize(400,350);//size of frame (in pixels) loanFrame.setVisible(true);//to make the frame visible JPanel loanPanel = new JPanel(new GridLayout(7,2,20,20));//to make the panel readable //buttons calculateButton = new JButton("Calculate above values"); calculate7Button = new JButton("Calculate 7yr/5.35%"); calculate15Button = new JButton("Calculate 15yr/5.5%"); calculate30Button = new JButton("Calculate 30yr/5.75%"); resetButton = new JButton("Reset"); quitButton = new JButton("Exit"); //labels principalLabel = new JLabel("Enter the loan principal");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
rateLabel = new JLabel("Enter the yearly interest"); termLabel = new JLabel("Enter the term (in years)"); paymentLabel = new JLabel("The monthly payment is:"); //text fields principalField = new JTextField("");//to enter principal rateField = new JTextField("");//to enter rate termField = new JTextField("");//to enter term paymentField = new JTextField("");//calculated payment shown paymentField.setEditable(false);//to not allow the user to change the result loanPanel.add(principalLabel); loanPanel.add(principalField); loanPanel.add(rateLabel); loanPanel.add(rateField); loanPanel.add(termLabel); loanPanel.add(termField); loanPanel.add(paymentLabel); loanPanel.add(paymentField); //to add buttons to the panel loanPanel.add(calculateButton);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2012 for the course ECON 101 taught by Professor Doc during the Spring '11 term at Yale.

Page1 / 6

2010-03-10_055929_McalcGUI4_copy - package...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online