File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Event problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Event problems" Watch "Event problems" New topic
Author

Event problems

Manny Ruiz
Ranch Hand

Joined: Dec 01, 2010
Posts: 40
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

Joined: Jun 01, 2010
Posts: 618
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

Joined: Jun 01, 2010
Posts: 618
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

Joined: Dec 01, 2010
Posts: 40
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

Joined: Jun 01, 2010
Posts: 618
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

Joined: Jun 01, 2010
Posts: 618
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

Joined: Dec 01, 2010
Posts: 40
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

Joined: May 03, 2008
Posts: 4543
    
    5

This appears to be continued in http://www.coderanch.com/t/522920/GUI/java/Scroll-panel-problems


luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Event problems