This site requires JavaScript, please enable it in your browser!
Greenfoot back
ManiHallam
ManiHallam wrote ...

2012/9/6

Counter Class error

1
2
3
4
danpost danpost

2012/9/8

#
If you wanted the credit() method to send text to display on the Screen object, then just use that one line ((Screen) getWorld()... in the credit() method, nothing more.
ManiHallam ManiHallam

2012/9/8

#
I did put that code in the world, without getWorld()
ManiHallam ManiHallam

2012/9/8

#
oh, sorry I didn't get your point. ok, then I just put this code in any class I want to update the Screen display. just a question, I put this code in the world as I mentioned before. I think it doesn't matter to leave it there, does it?
danpost danpost

2012/9/8

#
I think you misunderstand. You insert it into your code whenever you need to change the text of the Screen. It is not that just goes into a class. For example, if at some point the program catches that the user tried to dispense something without sufficient credit, you may want it to say something like "Make another selection". Wherever in your code you catch this situation, you add the line to change the text of the Screen.
ManiHallam ManiHallam

2012/9/8

#
wow! so it is a magic code. Thanks a lot. I got it now, so just substitute the text instead of the ("Credit: ").
ManiHallam ManiHallam

2012/9/8

#
I think it is better to say, just substitute the String in setText("string ") method.
danpost danpost

2012/9/8

#
Actually, it would be better to say, just substitute the String in the calls to setText("string"). BTW, you still have not seen my response in Private Messaging.
ManiHallam ManiHallam

2012/9/8

#
Thanks again, I am gonna to check it.
You need to login to post a reply.
1
2
3
4