//flex table opened by JP

Click to See Complete Forum and Search --> : java GUI's question


miggetyMike
04-02-2003, 04:39 PM
I have a game running and one clas is responsable for printing the graphics to a screen and I want to include on that screen a text field which can be printed to if something wants to talk to you. And I have separate items which are instances of a completely separate class that might want to talk to the screen. How do I give these objects the ability to write to the screen as well? I could pass a reference to all of the things that might be writing to the screen, but that sounds like a horrible way to go about it. Any suggestions?

qball
04-02-2003, 11:27 PM
write a method on the graphics object that just prints a String to what/where you want? Then any other objects can call that method with what they want to show?

miggetyMike
04-03-2003, 02:52 AM
But still, I'd have to pass a reference of that graphics object to every other object which I wanted to be able to print to the screen. This is what I;m trying o avoid....if possible.

qball
04-03-2003, 10:39 PM
But still, I'd have to pass a reference of that graphics object to every other object which I wanted to be able to print to the screen.


Ok, how are other objects gonna print to screen without reference to object responsible for the 'printing'?

They can 'print to screen' themselves? Or use interface to graphic object?

If you have a window object and you want other objects to update, then you need some way that must include window object.

Without more info on how these objects interact, my help sketchy...