File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes script question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "script question" Watch "script question" New topic
Author

script question

han happers
Greenhorn

Joined: Sep 02, 2008
Posts: 4
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

Joined: Jul 08, 2003
Posts: 24184
    
  34

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?


[Jess in Action][AskingGoodQuestions]
han happers
Greenhorn

Joined: Sep 02, 2008
Posts: 4
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

Joined: Oct 12, 2001
Posts: 1179

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??


Regards, Rene Larsen
Dropbox Invite
han happers
Greenhorn

Joined: Sep 02, 2008
Posts: 4
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

Joined: Sep 02, 2008
Posts: 4
nobody?? :roll:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Please read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: script question