import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat:
import javax.swing.JOptionPane;
import javax.swing.*;
import javax.swing.event.*;
public class paulfarquhar extends Applet implements ActionListener
{
double loan, interest, term, mpayment;
String list;
DecimalFormat df = new DeciamlFormat ("$#,#0.00);
Label loanLabel = new Label("Enter the amount of your loan: ";
TextField loanField = new TextField(10);
Button calcButton = new Button("Calculate");
Label outputLabel = new Label ("Click the Calculate button to see what your monthly payment will be.");
public void init()
{
add (loanLabel);
add (loanField);
JComboBox list = new JComboBox();
FlowLayout flo = new FlowLayout();
list.addItem("7 Years at 5.35%");
list.addItem("15 Years at 5.5%");
list.addItem("30 Years at 5.75%");
setLayout(flo);
add(list);
add(calcButton);
calcButton.setActionCommand("caculate");
calcButton.addActionListener(this);
add(outputLabel);
add(clearButton);
clearButton.setActionCommand("clear");
clearButton.addActionListener(this);
}
public void actionPerformed (ActionEvent e)
{
String arg = e.getActionCommand();
{
if (arg == "caculate")
{
if (e.getSource() == list)
{
String s = (String)list.getSelectedItem();
if (s.equals("7 Years at 5.35%));
term = (7);
interest = (.0535);
if(s.equals("15 Years at 5.5%));
term = (15);
interest = (.0550)
if(s.equals("30 Years at 5.75%"));
term = (30)
interest = (.0575);
}
}
}
}
}
The error I get is with the line right above my if statements pointing at the period right before getSelectedItem. The full error I get is: cannot resolve symbol
symbol : method getSelectedItem ()
location: class java.lang.String
Any help would be greatly appreciated.
Thank you.

New Topic/Question
Reply




MultiQuote




|