Stephan van Hulst wrote:Hi Warren, welcome to CodeRanch.
Please PostRealCode. Your example code is full of errors which makes it hard to figure out what the problem could be. Try posting an SSCCE so we can try it for ourselves.
Warren Kinny wrote:So if you think there code is "full of errors" then by all menas please point them out !
Jesper de Jong wrote:It's not a real and compilable Java program. To start with:
The keywords public and class are not spelled with capital letters.
What's this? That's not valid Java code.
Sorry to be so nitpicky, but the more exact you are when asking your question, the better people can help you get to an answer, without being distracted by other things.
With regard to your question, nothing has changed in newer versions of Java with regard to casting. So just using a newer Java version is not the cause of your problem.
Dennis Deems wrote: XW.template_reference will not be an instance of ExTemplate until some instance of ExTemplate is created and initialized in the ExTemplate constructor. Until then, it's just a null reference of type JFrame.
This line ExTemplate Temp = (ExTemplate) XW.template_reference; does NOT invoke a constructor. It merely grabs hold of a static reference and tries to assign its value to another reference.
Dennis Deems wrote:I changed my Eclipse compiler settings to 1.6 and pasted your code fragments into the editor. Eclipse's compiler was able to compile successfully.
Please correct my English.
Warren Kinny wrote:How do you cast a Sub-type value held in a variable of it's immediate Super-Type back to the Sub-Type for the benefit of the COMPILER ?
Dennis Deems wrote:I changed my Eclipse compiler settings to 1.6 and pasted your code fragments into the editor. Eclipse's compiler was able to compile successfully.
Don't get me started about those stupid light bulbs. |