aspose file tools*
The moose likes Beginning Java and the fly likes ACM library, add() method invoking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ACM library, add() method invoking" Watch "ACM library, add() method invoking" New topic
Author

ACM library, add() method invoking

You Gin
Ranch Hand

Joined: Jul 23, 2010
Posts: 52
Hi Guys. I'm not sure if I can ask questions about particular libraries, but I'll give it a try.

I'm using the ACM library in order to paint trivial objects. Here is a peace of code which is working just fine:


But when I'm making a separate method for this peace of code the rect will never be shown on the screen:


Please advice why is it so?

Thank you
Priety Sharma
Ranch Hand

Joined: Jun 10, 2008
Posts: 156

I dont have the ACM libraries.

So just a guess.
Can you try the call to the method paintBricks() this way.


instead of what you have written:


and see if it works without creating the aaa Game object?


Priety.
You Gin
Ranch Hand

Joined: Jul 23, 2010
Posts: 52
Yes, it works.
Can you explain the difference please?
Priety Sharma
Ranch Hand

Joined: Jun 10, 2008
Posts: 156

Ok I will try.

Can you paste the calling program too?
Maybe that has the answer.

You Gin
Ranch Hand

Joined: Jul 23, 2010
Posts: 52
Well, this is the calling program. There is no main method, the only run().
Priety Sharma
Ranch Hand

Joined: Jun 10, 2008
Posts: 156

Ok,

Maybe this is the answer.
Something like an infinite loop is happening.
When you ran the first program its run() method was called and you got the desired display.

In the second version you created a Game object inside run() method.
So when this Game object was created again run() got called and it became an infinite loop.

You could check if this is happening by putting a System.out.println("inside run") before creating the Game object in the run() method.

So the rest of the program never executes.

Try it out and lets see if I am right.
You Gin
Ranch Hand

Joined: Jul 23, 2010
Posts: 52
I like the idea, but this is not the case - I've got the only one println output
Priety Sharma
Ranch Hand

Joined: Jun 10, 2008
Posts: 156

Hmmmm
You will have to wait for a better explanation.
You Gin
Ranch Hand

Joined: Jul 23, 2010
Posts: 52
Anyway thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ACM library, add() method invoking
 
Similar Threads
while loop not working?
ACM.graphics.Goval Error
trouble with mouseEvents
Help me print out a triangle
For Loops making me loopy