• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event problems

 
Manny Ruiz
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all happy new year to all!, Hope everyone's holidays were good. Now it time to get back to the grind. I am creating a mortgage calculator that allows the user to select from a menu in order to set up the loan rate and terms. I created two earlier versions, one with out a menu and a second one with a menu. What I am trying to do i combine the two and create a cal so when the user selects the option, the coresponding text fields are set to the term and rate. I am using eclipse, and originally was getting errors at lines 133, 140, 147, 154 which was saying there was a duplicate method, which it then made a suggestion on how to fix it, which is why they are numbers 1-4. Everyhting works , but the fields dont populate when the options are selected. How close am i to getting this right and what am i doing wrong. Thanks in advance for any help.


 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of lines of code here. Can you point out the block of code that you think should be setting the fields but aren't?
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I compiled and ran your code (in Eclipse). I don't know if this is the specific problem that you asked about but unless you fill all four JTextFields with numbers, you are getting java.lang.NumberFormatException exceptions. You should check if the JTextField is empty before trying to parse it.
 
Manny Ruiz
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im not getting any errors, what im getting is nothing. When the user selects the loan rate and term from the options menu, the corresponding text fields need to be set to the amount. Right now when the user selects the loan options, nothing happens.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You define and use the class member variable listener but I don't see where you ever initialize it. And your actionPerformed*() methods are defined but I don't see where use them as action listeners.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EDIT: Oops. Ignore this. It is a reply to the wrong topic.

What is the size of your File array after you call File.listRoots()? What is the linesupposed to do? It looks like you are creating new instances of File rather than using the ones returned by File.listRoots(). What is the output from running this method? Does it return true or false?
 
Manny Ruiz
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I was able to get the program to work correctly, however I am having 2 problems. the first one is that the amortization schedule is not working correctly. i have always had problems getting these to work. Can anyone see whats going on with this. The other problem I am having is figuring out how to add a scroll bar to the jtextarea. I have looked through some websites, but I still cant figure it out.


 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This appears to be continued in http://www.coderanch.com/t/522920/GUI/java/Scroll-panel-problems
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manny, please UseOneThreadPerQuestion. Since this can be considered a separate problem I will keep the other thread open. That does mean that the scroll problem should not be discussed here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic