Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java swing star wars effect

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody..

i have create una animation of text...
this animation it's ok only with one string...i want create this effect with one file txt

this is my script...


this code read only last line of my document...why???
where is the error???
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It reads all lines, but it only stores the last one. You probably meant to write "text += s1" in line 51.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in this way goes all the text but all attacked him ... I would like to go out with \ n as the original text..

how to do???

help me please...
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't understand what you're asking; can you rephrase it? What does the code do now, and what would you like it to do instead? TellTheDetails.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok! sorry for my language.....
how do I store all the rows respecting the "\ n"?


 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the change I mentioned all lines will be stored. What do you mean by "respecting the \n"?
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one example

in my file is write:

1
beppe
paul
12
java
applet

whe run the program the letters out in this way:

1 beppe paul 12 java applet


thi is the problem....
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean when using drawString? It probably doesn't honor control characters. Why don't you keep the text in a List<String>, and iterate over that when drawing? You'd have to specify x and y coordinates for each line, but you will eventually have to do that anyway (as well as using different font sizes for different lines) if you want to achieve the Star Wars text effect.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic