• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

combo box

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can some one tell me what I am doing wrong here? I am trying to enable a listener to select the text from the combo box so I can set the string value from
String [] Irates ={"5.35","5.5","5.75"};
String [] Nyears = {"7","15","30"};

thses strings and assign them to these variables with a loop

double aprnum = Double.parseDouble("0" + apr.getText());
double yearnum = Double.parseDouble("0" + yearsField.getText());

I have read and tried this for the past 10 hours and everytime I get it setup where it will compile and run (I think) the buttons quit working.

http://java.sun.com/docs/books/tutorial/ui...html#uneditable

 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For starters:

1. You need an action listener for the "choices" combo box to see which loan type the user has chosen.

2. years and apr are returning null as you have it written. You don't need to store values in JTextFields such as yearsfield and apr. Get rid of those JTextFields. Then, you don't have to bother converting their text into doubles. you can keep them in memory by giving their value to a variable. This would be done in the action listener for the choices combo box as follows:


I don't see any loop in there that would list the balances, so you will need to add that somehow.
 
Rich Wilson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you it worked like a champ. I was trying that once before but I was not including it in the correct method.
 
I'm still in control here. LOOK at this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic