Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Validation Problems  RSS feed

 
P Bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I am brand new here and have a question with this gui project I am building, I have gotten the code to work in very basic forms such as the main part of calculations and etc. But now I am in the phase of validation to make sure the textboxes aren't empty and are in the correct format. I have done alot research already. I would like to use a Joptionpane to warn the user of an invalided entry. But I have tried many different methods and I can't seem to get them to work.

Any help would be greatly appreciated.

Thanks.



When ran I get these errors: (only copied a few of the main lines)

Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "p"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241)
at java.lang.Double.parseDouble(Double.java:540)
at car.loan.NewJFrameCarloan.calculateActionPerformed(NewJFrameCarloan.java:228)
at car.loan.NewJFrameCarloan.access$500(NewJFrameCarloan.java:17)
at car.loan.NewJFrameCarloan$6.actionPerformed(NewJFrameCarloan.java:106)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- read Offical Oracle tutorial - How to Use Formatted Text Fields

- you can to use JSpinner too
 
Campbell Ritchie
Sheriff
Posts: 55323
157
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
P Bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: I got the problem fixed. It was so easy it was funny. I had no idea it was going to be that easy to fix it. hahahahahaah! But I do have another question right now it has nothing to do with the code itself but with the method that the bank is using. I have an actual auto loan and the amount that I have do not match up to what with what my program says it should, nor do other calculators come up with the same figure. Plus the first payment only applied $1.11 to the principal. So I am wondering what kind of loan is this. This does not sound like a Simple interest loan. So what kind of loan is this? Does anyone know of a better way. Plus I might like to incorporate different ways a bank can loan you money into my program (ie simple interest, daily, etc) to help the consumer make a better decision when it comes to buying a car.
 
P Bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch


Thanks! In the past I have been to other websites looking for coding help before and some people can be very mean and rude. Its like the expect a beginner to be an expert. If you make a silly mistake then some websites like to ridicule you over it. For ( I typically don't like to name drop but in this case I will) example stackoverflow.com doesn't seem to be a very friendly place for beginners, I even complained to stackoverflow.com and basically all they said is they were sorry for my experience, literally that's it. So I'm hoping this is a much friendlier place
 
Campbell Ritchie
Sheriff
Posts: 55323
157
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome We try to stop people being rude to one another here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!