I am a beginner to java but I have written some basic C# before. But i have never really grasped the OOP concept.
I am starting a project recode for a program i wrote in C# with a better GUI.
Basically in this code I am trying to create a instance of a "LoadIni" class and then get/set the data in it while running its procedures to write to the ini and read from the ini.
Here is my first class EOMWindow:
This is my second class which is called IniControl
The issue i am having is i can't use the line
as it gives the error : non-static varible csvExportDirectoryText cannot be referenced from a static content.
Also i am unable to use the instance "ini" in my button actions (closeButtonActionPreformed) obviously because the IniControl is created within the Run function. How do i place the LoadIni instance so i can access it in the entire EOMWindow class ?
Thanks you very much for reading and any help would be gratefully appreciated .
Joined: Oct 02, 2012
Just an update.
I have realised that the error didn't relate to the "ini.ReturnAuditDir" but actually to the csvExportDirectoryText.setText being set from within that void.
But i still have an issue on accessing the "ini" instance in the rest of the class.
You can tell people who come from C#; they go straight for an IDE. And they get code with the IDE’s personality stamped all over it
C# is an OO language, too. How have you managed to write C# without learning object‑orientation?
The ini variable appears to be a local variable in the overridden run() method. When you get to the end of the method, it goes out of scope. You might need an Application class, which has a Wini object as a field. Initialise the field from the Application constructor. That is the sort of thing which is difficult to do from underneath a GUI. You would probably do better to remove the GUI for the time being, and set up the application like a ConsoleApplication. Once you have it running nicely at the command line, then you can replace the GUI on top of it. Obviously you can record your GUI code somewhere to make it easier to reconstruct.