I am a student and was asked to write a mortgage calculator program using the GUI. I wrote it but it is giving me an error. I spent some time to debug it but I am not able to determine what's causing the problem.
Can you plese help to resolve my problem?
.java and . form are in the below directory.
06-06-2005, 06:39 AM
sjalle
Ok, I have gotten rid of the arrayIndex exception, I've moved some
variables up to class-level and fixed the logics in jButton1ActionPerformed.
I also put in a numeric validity check. I've had to replace your layout
with an XY-layout to make it compile on my system.
I noticed that you haven't added the radiobuttons to the buttongroup, but
I didn't do anything about it, since it seems to be within the realms of
your development tools auto generated code.
Btw, except for a thankyou, you owe me nada :)
Code:
/*
* Ozdinc_Week_3.java
*
* Created on May 29, 2005, 2:53 AM
*/
import java.lang.*;
import java.math.*;
import java.text.*;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
/* @author Chad Ozdinc
*/
public class Ozdinc_Week_3 extends JFrame {
// Decimal format
static DecimalFormat decmat = new DecimalFormat("$#,##0.00");
static double[] rate = new double[] {
.0535, .055, .0575};
static int[] term = new int[] {
7, 15, 30};
/** Creates new form Ozdinc_Week_3 */
public Ozdinc_Week_3() {
jbInit();
setSize(575, 575);
this.setTitle("POS/407 Chad's Mortgage Calculator");
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void jbInit() { //GEN-BEGIN:initComponents
buttonGroup1 = new javax.swing.ButtonGroup();
Amount = new javax.swing.JTextField();
jTextPane1 = new javax.swing.JTextPane();
term1 = new javax.swing.JRadioButton();
term2 = new javax.swing.JRadioButton();
term3 = new javax.swing.JRadioButton();
jButton1 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
textOut = new javax.swing.JTextArea();
monthlyPay = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
btnClear = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();