ActionEvent problem when combined with becker robots
I have created a class (MapBuilder) whose object loads a map from a txt file that has been saved using a UI that is a class (MazeEditor) I also made. MapBuilder, therefore, creates a City object from the becker.robots class. It translates the visual information from MazeEditor into information on a txt file that can be used to create a city and robot from the becker.robots package.
The MazeEditor UI has a button which calls a new MapBuilder object, purpose being so the user can actually run the maze they have just created from within the UI. Because the MapBuilder object creates this City object, the City object is all within what I believe to be a JFrame. This means that there is another JFrame open on top of the MazeEditor UI JFrame and they aren't modal. (I tell you this for more information in some bid to get to the bottom of this).
I also believe that there is some sort of threading going on with the City object, since in any normal circumstance, when the City object is created, any robot commands from anywhere within a class referencing a robot within the City, to move it, are not executed until the user presses the 'Start' button which comes with the City object. Excuse my very loose and uneducated use of the threading element because I know very little about that side of things at the moment.
My actual problem is this: If I ensure there are no commands to move the robot in any way, then the City object gets created successfully and everything is visible... Walls are where they should be and robot is where it should be. However, if I place any commands within the code to actually move the robot, then when the City object is created, I get an entirely blank JFrame window pop up... Completely grey, with nothing in it.
I am not sure if it is something to do with the ActionListener function not finishing its code before the City object interrupts itself by somehow temporarily 'hanging' whilst waiting for the user to press the 'Start' button that is supposed to be there, for the robot to move.
I tried to explain this as best I could, I hope anyone reading this was able to follow it. I haven't included any code as there is so much of it and I thought that maybe an explanation would suffice for this particular problem. If I am wrong then let me know and I will post up whatever code deemed necessary.
What I will say, is that the function following the ActionEvent triggered when the user clicks the button, first ensures that there is a file to load by irrelevant means and then calls an object of MapBuilder by simply 'new MapBuilder(fileToBeLoaded). It is within MapBuilder that calls a new object of City.
Any light on this would be hugely appreciated since I have spent literally days trying to figure this out, with all kinds of experiments and internet research, to no avail.
The answer may be a while yet
Unfortunately, I am currently studying at university and at this time have about 2 weeks to hand in 3 different projects so I will have to dedicate my time to finishing them off.
This Java maze editor thing is really a side project I created which at the risk of sounding like I am blowing my own trumpet, is way beyond what we are currently being taught, or what is required for the assignment. I enjoy programming so much (almost obsessively compulsive) that I kind of got carried away reading books and playing around with code and neglected 2 projects concerning other modules.
Therefore, I am hoping that it is OK for me to keep this thread open for some time, just until I have handed in my projects and then I can crack back on with this. I say this because, upon embarking on reading this excellent new material you provided, I see that it is going to take some time that I don't have right now, for me to fully understand the whole thread concept which I can see is exceedingly valuable to the whole programming experience. So, providing it is OK for me to leave this thread open, I will check back in here in a couple of weeks or so with problems/solutions.