i have one question, but worded two different ways so people who know a lot about gridworld might understand and or someone who is knowledgeable in Java could help also
is there a way to cast "Class" to the original class which was sent to the function?
or
is there a way to be able to programatically change an object's (for example Actor) image?
***From info.gridworld.gui
/**
* Constructs an object that knows how to display an image. Looks for the
* named file first in the jar file, then in the current directory.
* @param imageFilename name of file containing image
*/
public ImageDisplay(Class cl) throws IOException
{
this.cl = cl;
imageFilename = cl.getName().replace('.', '/');
URL url = cl.getClassLoader().getResource(imageFilename + imageExtension);
if (url == null)
throw new FileNotFoundException(imageFilename + imageExtension + " not found.");
tintedVersions.put("", ImageIO.read(url));
}
ps: i did try to cast it like normal and it didn't work.

New Topic/Question
Reply



MultiQuote







|