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

script question

 
han happers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody! My name is Han and I am a beginner in Java en I bought the book 'head first java'. I really love the book, only I got a script(from the book page 384) here and it isn't working
It is supposed to be a simple animation, but java doesnt see the
PaintComponent function in the inner class, so i only get a square with a round on it.
I hope somebody can help me.

greetz Han



[ September 13, 2008: Message edited by: han happers ]
[ September 13, 2008: Message edited by: han happers ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Looks basically OK to me, except that in the go() method you're constructing an instance of MyDrawPanel, but in the code the class is named MydrawPanel; as such, this won't compile. Perhaps you've got another MyDrawPanel.class lying around from a previous compilation?
 
han happers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.
I am affraid not
Maybe a weird question, but why can't he take an instance of the innerclass?

greetz,

Han
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the code you have posted, I get a green drawing line downwards to the right.

Isn't it that was it expected to do??
 
han happers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response,
yes it is and that's strange, I only get a round shape that is getting
a different color for 130 times.

I have a feeling i'm doing something very wrong.
Maybe you or someone else know where the problem is?
Sorry i am completely new to Java.

greetz

han
 
han happers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nobody?? :roll:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by han happers:

Maybe a weird question, but why can't he take an instance of theinnerclass?


Hi Dear,

If you are reading Head First Java...Remember One Rule that Kathy seirra always mentioned in her books - There is no dumb Question
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic