Getting a string from one class to write to a front screen class
<p>I'm create an air traffic control system, where it generates a random amount of fuel and also a random amount of planes. I have these two elements done, however the issue is, in the output box it all shows and works perfectly. My issue is that I'm telling it, if there is no planes coming in to call the string no planes and if there is a plane then KLM. I can't get it to write to the main class with all the front end.</p>

<p>I've edited out some of the coding in the screen as I'm using Netbeans drag and drop front end:</p>

<pre><code>enter public void StartSimulation()
{
     Start pointer = new Start();
     Plane incoming = new Plane();

        //Needs a condition in here that checks if the plane and fuel has been
     //Generated and also loop to keep up with the constant generated planes and fuel
         jTextArea1.setText(incoming.planeName);
</code></pre>

<p>I have tried where the condition thing is the following:</p>

<p><code>if (incoming.nextPlaneLanding != 167)</code> this generates the first thing over and over again in the output box. I've also tried setting a boolean in the plane class but again, it has had no effect even with the following condition around it. <code>if (incoming.completed = true)</code></p>

<p>This is the stuff I have in my plane class:</p>

<pre><code>class Plane 
 extends TimerTask
{
    public int nextPlaneLoop = 0;
    public int planes;
    public int fuel;
    public String planeName;
@Override
public void run()
{
    if(nextPlaneLoop &lt;=167)
    {
        //Currently only running 1 or 0 planes...
        planes = (int) (Math.random()*((2-1)+1));
        System.out.println("Random generated plane amount: "+planes);
        System.out.println("Method called, one whole day loop");
        //Adds to the plane in the airspace loop
        nextPlaneLoop++;
        System.out.println("Loop incrementing: "+nextPlaneLoop);

        if(planes == 0)
        {
        System.out.println("No fuel is required as no planes are coming in");
        planeName = "No incoming plane";
        System.out.println("Planes name is: "+planeName);
        System.out.println(" ");
        }

        else
        {
       //Amount of fuel
        fuel = 30 + (int)(Math.random()*((120-30)+1));
        System.out.println("Random fuel: "+fuel);
        planeName = "KLM AirFrance";
        System.out.println("Planes name is: "+planeName);
        System.out.println(" ");
        }
    }
    else
     {
        this.cancel();
        System.out.println("Not in loop any more. End of day");
      }
}
}
</code></pre>

<p>Can anyone suggest have to how to get the names to display on to the screen so I can then try and add them into a queue in the actual airport class.</p>
