I want to change the DefaultDisplay
class of the GridWorld GUI so I can change the image of an actor during a run, and since I am using a jar file of the code I am creating a subclass CustomDisplay
of DefaultDisplay
.
However, since creating a subclass would be changing the name, I would have to create subclasses of the classes that use DefaultDisplay
so that they would be updated to use CustomDisplay
instead of DefaultDisplay
. For example, I would have to make a subclass of DisplayMap
named CustomMap
that instead of this:
private Display defaultDisplay = new DefaultDisplay();
said this:
private Display customDisplay = new CustomDisplay();
and then any other class that used DisplayMap
would have to be changed to use CustomMap
. It seems very inefficient to make subclasses of all of these classes just because they use classes that I change.
Is it possible to make it so that CustomDisplay
will automatically be used instead of DefaultDisplay
so I only have to change the one class?
Notes
- The classes I am talking about are not on the normal javadoc, but can be found here.
- I checked through Extending GridWorld & found a lot of information, but nothing that would help with this.