Variables Problem

Hi,
I am having a problem with a networked game I am making, I was unsure if the post should have been in here or networking. Sorry if it is in the wrong place. When a new player connects they are given a set of variables. I am struggling to do this. This is what I came up with:

	public void processdata()
	{
		try
		{
			if(whatinformation != null)
			{
				int isa = whatinformation.indexOf("a");
				int isb = whatinformation.indexOf("b");
				int isc = whatinformation.indexOf("c");
				int isd = whatinformation.indexOf("d");
				what = whatinformation.substring(isa+1,isb);
				if(what.equals("#"))
				{
					square1xpos = whatinformation.substring(isb+1,isc);
					square1ypos = whatinformation.substring(isc+1,isd);
					square1x = Integer.parseInt(square1xpos);
					square1y = Integer.parseInt(square1ypos);
					amountofplayers += 1;
				}
				if(what.equals("~"))
				{
					square1xpos = whatinformation.substring(isb+1,isc);
					square1ypos = whatinformation.substring(isc+1,isd);
					square1x = Integer.parseInt(square1xpos);
					square1y = Integer.parseInt(square1ypos);
				}
			}
		}
		catch ( Exception err )
		{
			err.printStackTrace();
		}
	}

This was a bad mistake when using this code to paint them to screen:

		public void paintComponent(Graphics g)
		{
			g.drawImage(square1, squarex, squarey, this);
			for(int i=0; i < amountofplayers; i++)
			{
				g.drawImage(square2, square1x, square1y, this);
			}
		}

This was causing the players to jump all over the place because they were sharing the same variables. I have tried using an arraylist but couldn’t manage to update the variables inside it. This made the players not see eachother move. I have tried an ordinary array but couldn’t do it that way either. I would be thankful if anyone could help me using some sort of technique to fix this problem. Each player is suppose to get a different set of variables to manage their position in the world. I think an array would do the trick but when I tried it didn’t work. I probably made a silly mistake though.
Thanks.

[quote]I have tried using an arraylist but couldn’t manage to update the variables inside it. This made the players not see eachother move. I have tried an ordinary array but couldn’t do it that way either.
[/quote]
How are you trying to update the variables for each player?

Use an object for each player? It’s like… fantastic.