Hi, I'm having some difficultly figuring out how to put a value to my combobox items. For example I have 3 states listed in the combobox.
String[] stateStrings = {"Michigan", "Wisconsin", "Illinois"};
JComboBox jComboBox = new JComboBox (stateStrings);
jComboBox.setSelectedIndex(2);
jPanel3.add(jComboBox);
I need to put different yearly interest rates or APR values on each. These rates are later put into the monthly payments formula:
int r=(p*(i/100))/(1-(Math.power((1+(i/100)),(n*(-1)))));
after making APR = interest rate.
My question is how do I accomplish this. I also would like some help on how to make my try and catch statements work for the better. I tried toying around with it but I'm having difficulty understanding the concept. I really caught on to Visual Basics fairly easy than this and I can't understand how.
For example:
public void actionPerformed(ActionEvent e)
{
try
{
int principle=Integer.parseInt(jTextField1.getText()), downPayment=Integer.parseInt(jTextField2.getTest()), temp;
resultArea.setText("");
// This subtracts the downPayment from the principle
if (p<b)
///need the downpayment to be subtracted from the principle amount and catch error if anything is typed into each field other than a integer
}
catch (Exception ex)
{
// If anything other than two integers are input, print out the error
message
resultArea.setText("Input House Price");
}