2 Replies Latest reply: Jun 30, 2007 11:44 PM by 3004 RSS

    passing an array from one method to another

    807600
      I am passing an array from method 1 to method 3 in an applet
      I maded the array a class variable to do this
      The applet runs, but nothing seems to be in the array.
      Trying to debug this, I have tried to paint the screen as the array is being built in the load method. I have yet figured out how to do this. So I made this a non applet class, put it in debug, and the array seems to load okay.


      import java.applet.Applet;
      import java.awt.*;
      import java.io.*;
      import java.util.*;
      import java.net.*;


      public class urla extends java.applet.Applet
      {
      int par1;
      int i = 1;
      int j = 20;
      int m = 0;
      int k = 0;
      String arr[] = new String[1000];
      String inputLine;



      public void load() throws Exception
      {

      try
      {
      String parameter = getParameter("par1");
      if (parameter != null)
      par1 = Integer.parseInt(parameter);
      else
      k++;
      URL mysite = new URL("http://www.xxxxxxxxxxxxxx.html");
      URLConnection ms = mysite.openConnection();
      BufferedReader in = new BufferedReader(
      new InputStreamReader(
      ms.getInputStream()));

      while ((inputLine = in.readLine()) != null)
      {
      arr[m] = inputLine;
      m++;
      repaint();
      }

      in.close();
      }
      catch (MalformedURLException e)
      {
      k++;
      }

      }
      public void update(Graphics screen)
      {
      screen.drawString("THE FOLLOWING HAVE ADDED THEIR BIOS:",5 ,5);
      for (int i = 0; i < 20; i++);
      {
      j = j + 20;
      screen.drawString("output - "
      + arr, 5, j);

      repaint() ;
      }

      }
      }