I'm glad you've got it sorted out.
There seem to be some other problems with that event handler that should come to light as you test it. (Make sure the answers you get are reasonable!)
Type: Posts; User: pbrockway2
I'm glad you've got it sorted out.
There seem to be some other problems with that event handler that should come to light as you test it. (Make sure the answers you get are reasonable!)
You read the stack trace from the top down until you reach a line which mentions your code. This is a good place to begin looking for the source of the problem.
In this case the problem is...
You have variables like distance declared twice and this is causing no end of problems.
At the risk of repeating myself, having sensible (descriptive) variables stops the problem from ever...
That doesn't look right to me because MPG is a JLabel with the text "What is the Vehicles MPG?". And parsing that text as a float won't lead to anything good...
---
A couple of observations -...