Problem has been solved
I have a javaFXML application. I want from my controller to use this object:
TempClass tempObject = new TempClass();
I put the above piece of code inside this method
public class FXMLDocumentController implements Initializable
When I run it, it says that this line
TempClass tempObject = new TempClass();
is not found.
Here what I did then but I failed in fixing it anyways:
1- I made sure that the TempClass class is in the same package (in such a way that I can see that my controller and my class are in the same file).
2- I tried to put above it @FXML trying to see if this works but it i did not.
3- I thought that I can just define this class object in the main FXML java file (the one that has the the start method) but the problem is that the IDE underlines every tempObject word in the controller.
So, all what I did is useless. How can I define it then? Update: Also, if it is applicable, is it a logical problem or a just a technical java problem?
Note1: I am really a beginner in java.
Note2: I think my problem is more to be related to how JavaFXML works than to be related to an OOP misunderstanding but anyways I included the tag: class just in case.
EDIT1: Here does not answer my question in an efficient way and here is why:
1- My question is so specific between a java class and the controller. The question in the link, however, answers a very general case, and indeed, it might answer the case where someone wants to make a communication between two windows or passing parameters to the controller (so an "A" method uses the controller) but my question is that how to let the controller uses my method). With all what I said, I do not deny the fact that this is very related to my question but it is not within the same scope.
2- My level of understanding java is so weak. I know that this is my problem but I am trying to solve the problem, not necessarily the way I want, but the way that can fit my code so that I do not change the whole code. i.e, I keep up with new ways of understanding how Java works and at the same time I try to tolerate my low level of understanding or my weak experience with Java tools and libraries.
EDIT2: The purpose of my class: My class is just a "flag" class. I am just sending notifications (flags) from my controller's buttons to my class variables. When I click on another button, I need to have these flags so that I know in what state I am.