Main Class:
public class Table extends java.applet.Applet implements Runnable
{
public void init()
{
try
{
Balla.addBall();
}
catch(Exception e)
{
}
}
}
Method:
public class Balla
{
public static int balls=0;
public static void addBall()throws IOException
{
Random generator = new Random();
Ball b = new Ball(100,100,8,Color.blue,generator.nextInt(4)+1,generator.nextInt(4)+1);
FileWriter fw = new FileWriter("C:\\temp_Jon\\BallData.ballz",true);
PrintWriter pw = new PrintWriter(fw,true);
pw.print(b.getX()+" "+b.getY()+" "+b.getRadius()+" "+b.color+" "+b.speedX+" "+b.speedY+"\n");
System.out.println("qqq");
pw.close();
fw.close();
balls++;
}
}
It never actually does what I want it to do and I used the try and catch in the first place because I could not apply throws IOException to the init method.