I'm currently working on making a basic TextEditor in Java FX but I'm having a bit of difficulty. I am trying to incorporate the MVC development style and using any object of type Document in the model when working with the editor although when I try to save the area of the contents I get a NullPointException when I try set any variables in the when the Document is initialised to null. It works fine with it set to a new document will null parameters though...
Any information on the reasoning for this would be really appreciated!
Edit:
Sorry for the ambiguity, I was meaning in terms of initialising an object that I am trying to then set variables for. I had it initialised to simply null:
Document workingDocument = null
When I changed this to:
Document workingDocument = new Document(null, null);
I understand what creating a new Documents does in terms of memory but not what simply initialising it to null does...