Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie, Please Help: Why can I not get the numbers to display

 
Patrick Miller
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to write a program that shows three stations that collect numerical data for rainfall. I suppose to be able to put the number in and click enter and the number will show up in the box beside the input box. Then the input box goes back to 0.0, and anytime I add a number to it, it totals to the box on the right. What am I doing wrong? Please help. I am running out of time. Here is the program I have written so far.


[ November 17, 2004: Message edited by: Patrick Miller ]
 
Patrick Miller
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help with this. I need to have it done by tonight. Thank you.
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
super("Eric Luce's Final Project");


Patrick, what are you doing with Eric's project ?
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patrick,

Look carefully at the code I've changed from your version.



I have got the first two stations working and have left the last for you to figure out. There were one or two small problems with the way you were creating and initialising your GUI components. You were declaring at the top for example like

JTextField j = etc etc

and then creating j again lower down in the contstructor method.

If you look closely at the code I have changed, especially where the ocmponents are created, you should be able to figure out how to add inthe third station yourself.
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are you doing with Eric's project ?



hmm, good point. didn't spot that. :roll:

I forgot to mention also that you need to look at what I've done to retrieve the contents of each text field and convert that string to a double. What you had before (especially myNumberIn1() ) made no sense. myNumberIn1 is a JTextField object which has a method getText().
 
Patrick Miller
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Don Kiddick:


Patrick, what are you doing with Eric's project ?


Ok, you caught me. Now you know my real name. The other name I use for privacy.
[ November 17, 2004: Message edited by: Patrick Miller ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic