Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help with string array using methods

 
Jere Johnson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
This program compiles correctly, but
i cant seem to get anything to appear on my applet screen except for the textField with the current program down below. Can anyone see a problem, i cant?
i think im seeing doubles, since ive been looking at
this program for 30 hours.


__________________

(Marilyn added code tags)
[ March 30, 2003: Message edited by: Marilyn de Queiroz ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, you should edit your post and use the CODE tags so that it preserves your indentation. This will make it much easier for us to read.
 
Jere Johnson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does everybody on this JavaRanch site seem so uptight about "the right thing to do".
Im not getting any answers with my posts, Just you should do this and that!
what kind of a site is this?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it is because we expect people that ask questions to show some courtesy. Remember we aren't paid for helping you, so we at least want some respect and some sign that you are willing to put effort into it. The code you posted definitely shows that you are putting effort into it. Editing the indentation style was just a small suggestion. It shouldn't take you all that much time. It seems to me that YOU are the one that's uptight about this. Please don't take offense from a suggestion that was intended to help us help you more efficiently.
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show a little respect when you ask questions and you will find lots of people who will try and help you. If you spend any time at this site most posts which contain code make use of the *code* tags. It makes the post easyer to read. The easyer it is to read the question the better chance you have of getting an answer.
At the moment it is the weekend, so you don't have as many people showing up to read your question, which may be one reason you are not getting as many responses as you were expecting.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if you spell correctly, your post will be easier to read.
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spelling errors don't bother me, since I can't spell myself.
People who write "u" for "you" and "r" for "are" do bother me. That and the fact that these same people seem to have a hard time with correct grammer usually make the posts really had to read.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was just the smart ass in me coming out. I didn't mean it too seriously. I usually can get past bad spelling, and even bad grammar sometimes. I usually take bad grammar to mean that English is their second language. To me, that means they should be encouraged to keep working at it and not condemned for their little mistakes. I apologize if my facetiousness came across too seriously...
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, someone who knows what they are doing, help this guy out. Thanks.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Program looks incomplete to me. How can I compile and run it when there is stuff missing ?
 
Jere Johnson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im getting more dos and donts.
told ya :roll:
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little bit confused as to what the program is supposed to accomplish. However, the error seems to be in the display method:

What was happening was that the Strings was being displayed all on top of each other outside the bounds of the applet's viewable area.
This of course begs the question, why?, but I think that this should get you started now.
[ April 01, 2003: Message edited by: Joel McNary ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problems:
Your program has no indentation, which makes it needlessly difficult for us to understand.
Your program does not compile because you didn't include enough of the program text to make it compile. Again, making it needlessly difficult for us to understand.
I made some guesses at what might be missing, added proper indentation, and also added some System.out.println() statements to see what was going on:

It looks like the main problem is that you always call readData() from inside paint(), and your event handler does input.setText(null) immediately before calling repaint(). This means that any time you call readData(), the data being read is just a null. Try commenting out the input.setText(null) for starters. I can't really tell what your program is supposed to be doing, but at least with the println() statements you'll have a better idea what it actually is doing.
 
Jere Johnson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
The input.setText(null) statement doesnt do anything but blank out the TextField after
you hit enter. Thats it.
As for the program:
I want to display 10 strings on the applet after
i enter 10 strings into the TextField.
i get the program to run with entering a string in the textField outputs the string in the applet. Yet, doesnt return 10 different strings on a seperate line.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works fine for me in AppletViewer

Thankyou for the chance to learn about Applets today.
[ April 01, 2003: Message edited by: Barry Gaunt ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeremiah Coleman:
Im getting more dos and donts.
told ya :roll:

What else did you come here for then if not for us to tell you how to do your program or what not to do in your program?
 
Jere Johnson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry you are a KING!!
Program works great. Thanks for your
ideas from your motor cranium.
Rock on bro! Beers on me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic