I once upon a time had problems with buttons and getting windows to show up, now cannot get output of loan data into JList, code is below, any suggestions? next change is to add array (which I think I can do) and graphics in the form of a graph but one step at a time.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.text.NumberFormat;// import to display money
public class loanGUI2 
{
        private String intPd;
        private double interestPaid;
        private String lnAmt;
        private double loanAmount;
        private String prinPd;
        private String lnPmt;
        private String bal;

        private double balance;
        private double loanPayment;
        private double principlePaid;
        
	private String input;

	private int loanTerm;
	private double interestRate;
	private Loan LoanA;
        private String input2;
	private String button1Label = "10 years at 3.8%";
	private String button2Label = "20 years at 4.5%";
	private String button3Label = "30 years at 5.75%";
	private String button4Label = "submit";
	RadioListener myListener = new RadioListener();

	JFrame aWindow;
	JButton submit;
	TextField txt;
	JPanel panel;
	Container content;


	loanGUI2()
	{
		aWindow = new JFrame("Loan Amortization table");
		submit = new JButton(button4Label);
	    txt = new TextField();
	    panel = new JPanel();

	    configDisplay();

	    inquireLoanAmount();
	    inquireTerms();
            interestPaid = Double.parseDouble (intPd);
            loanPayment = Double.parseDouble(lnPmt);
            principlePaid = Double.parseDouble(prinPd);
            balance = Double.parseDouble(bal);
	    LoanA = new Loan(interestRate, loanAmount, loanTerm);
	    LoanA.calcPayment();
            loanPayment = Double.parseDouble (lnPmt);

	   //table display
             //String[] data ={lnAmt, lnPmt, intPd, prinPd, bal};
             //JList results = new JList(data);

                //JScrollPane display = new JScrollPane();
                 // display.getViewport().add(results);
	}

    private void inquireLoanAmount()
    {
    	input = JOptionPane.showInputDialog("Please enter loan amount");
        loanAmount = Integer.parseInt(input);
    }
    private void inquireTerms()
    {
    	input = JOptionPane.showInputDialog("Enter terms to enter loan terms or options for preset terms");
    	if ( input.equals("options"))
    	{
    		// Radio buttons for choices of term/interest rate numbers
      	  JRadioButton button1 = new JRadioButton (button1Label);
      	  button1.addActionListener(myListener);
      	  JRadioButton button2 = new JRadioButton (button2Label);
      	  button2.addActionListener(myListener);
      	  JRadioButton button3 = new JRadioButton (button3Label);
      	  button3.addActionListener(myListener);
      	  //  add buttons to window
      	  ButtonGroup group = new ButtonGroup();
      	  group.add(button1);
      	  group.add(button2);
      	  group.add(button3);
      	  content = aWindow.getContentPane();
      	  content.add(submit);
      	  content.add(button1);
      	  content.add(button2);
      	  content.add(button3);
      	  submit.addActionListener(myListener);
      	  content.setVisible(true);
      	  aWindow.setVisible(true);


    	}
    	else
    	{
                input = JOptionPane.showInputDialog("Please enter loan term");
    		loanTerm = Integer.parseInt(input);
                input2 = JOptionPane.showInputDialog("Please enter interest rate");
                interestRate = Double.parseDouble(input2);
                aWindow.setVisible(true);
    	}

    }
    private void configDisplay()
    {
    	Toolkit theKit = aWindow.getToolkit();
        Dimension wndSize = theKit.getScreenSize();
        // sets window to half screen
        aWindow.setBounds (wndSize.width/4, wndSize.height/4,
                           wndSize.width/2, wndSize.height/2);
          // Container content = aWindow.getContentPane();
        aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
        aWindow.getContentPane().setBackground(Color.BLUE);
      



        FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
        Container contain = aWindow.getContentPane();
        contain.setLayout(flow);
    }

class RadioListener implements ActionListener, //only one event type needed
ChangeListener, //for curiosity only
ItemListener {  //for curiosity only
public void actionPerformed(ActionEvent e)
{

	if (e.getActionCommand() == button1Label)
	{
		System.out.println(button1Label + " pressed.");
		loanTerm = 10 * 12;
		interestRate = 3.8/100;
	}
	else if (e.getActionCommand() == button2Label)
	{
		System.out.println(button2Label + " pressed.");
		loanTerm = 20 * 12;
		interestRate = 4.5/100;
	}
	else if (e.getActionCommand() == button3Label)
	{
		System.out.println(button3Label + " pressed.");
		loanTerm = 30 * 12;
		interestRate = 5.75/100;
	}
	else if (e.getActionCommand() == button4Label)
	{
		System.out.println(button4Label + " pressed.");
		content.setVisible(false);
	}
}
@Override
public void itemStateChanged(ItemEvent arg0) {
	// TODO Auto-generated method stub

}


@Override
public void stateChanged(ChangeEvent arg0) {
	// TODO Auto-generated method stub

}
}
}

Where in the code do you look for the problem area?
Could you mark the location with a comment like: // *** HERE IS THE PROBLEM ***
and then tell us how you have marked the code so we can look there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.