I agree with angstrem. And, imho, some such "recipe" (algorithm) is the place to start rather than code.
Type: Posts; User: pbrockway2
I agree with angstrem. And, imho, some such "recipe" (algorithm) is the place to start rather than code.
You're welcome.
dNow is never given a different value after it is initialised.
You could do away with the variable altogether and say
jLabel2.setText(ft.format(new Date()));
// some code
// and later......
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...
Hi Santosh, welcome to the forums!
You can declare a variable of any type (including an array) outside any method but initialise it inside a method. That way one method can be responsible for giving the variable a value, but other...
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...
As an aside if you're like me you'll make lots of typos as you learn a new technology. "The method whatever() is undefined etc" is common indication by the compiler of a typo.
The API...
It might be that the newline character is being written, but not being displayed properly by whatever program you are using to read the file later. The Windows program Notepad is like this and will...
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 -...
It is the job of a constructor to make sure all of the instance fields are properly initialised. So, consider having a single constructor that is passed all of the values.
Hi sparks, welcome to the forums!
Hi Chirag Talreja, welcome to the forums!
Hi JoaoDias51, welcome to the forums!
Hi ocdjg, welcome to the forums!
Is there a reason why you aren't using Swing? (JFrame, JButton, etc)
Basically you should write an action handler that sets the button text. And add that handler to the button so that it does its...
As a general rule: work one small step at a time.
So step back from your cake application as it currently stands and write something with a single button that makes a single change to the GUI. ...
How do you know the conditions are not met? Print out the values of the interesting conditions before you start the if blocks. This will help with debugging.
I agree with jps - without code...
Hi Toad, welcome to the forums!
You're welcome.
OK.
You read these stack traces from the top down, until you reach a line of your code (which happens rather soon here!). It is saying that the problem is an ArrayIndexOutOfBoundsException. In...
Sorry, I can't read the image.
What is the stack trace? (the thing that says what the exception is, and then gives a list of lines of your code to go looking at)