If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Why is this in the console?

I have an applet with 7 textfields (3 for input and 4 for display). Now, the applet runs fine without any syntactic or semantic errors, however I get this:

Code:

Exception in thread "AWT-EventQueue-1" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at BirthdayApplet.actionPerformed(BirthdayApplet.java:86)
at java.awt.TextField.processActionEvent(Unknown Source)
at java.awt.TextField.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-1" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at BirthdayApplet.actionPerformed(BirthdayApplet.java:89)
at java.awt.TextField.processActionEvent(Unknown Source)
at java.awt.TextField.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Whenever I input something in the textfield and hit enter. Is this a problem, or just console output?

Yeah I'm pretty sure most things in this program are formatted badly right now (I have no idea how to do this program..so I've been trying to work 'around' so to speak and it isn't working out too well). The code isn't commented very much right now but the problem is this:

Write a program that tells the day of the week someone's birthday falls on this year.

Somewhere along the way my professor wants us to call a method that validates if the year the user put in is a leap year (I'm not sure why). A couple of things are still messed up (January 1, 2000 and January 1, 2001 both come out to be Saturday even though I incremented the date if the year was a leap year).

Now, I don't know if incrementing the date if the year was a leap year is right or not (because no matter what the date is still going to fall on the same day this year no matter what year you were born). But we were asked to put a check in..so I did.

If the month is greater than February then it checks if the year is a leap year. If so, it adds one to the day variable, adjusting the day of the week accordingly. I don't really know if that needs to be there..because one of the months is bound to have 32 days now throwing everything off, and even if someone was born on a leap year their birthday will still fall on the same day of the week this year.

I wonder if I should just get rid of that check, or make it so only February is affected by the leap year?

Interesting. Although I figured out why I was getting junk in the console..I had no e.getSource() parameters..so the console didn't know that the textfields were actually getting input. All works great now, except one minor thing. If someone types a string into the textfield..the console will fill up with junk again because it doesn't know how to handle strings. Is there someway I can check that the input is a number?