import java.util.StringTokenizer; public class Ball extends Chat { BallFrame f; public static void main(String[] args) { readArgs(args); Ball client = new Ball(); client.listen(); } public void receive(String line) { int x = 0; int y = 0; String typ = "rel"; if (line != null) { StringTokenizer st = new StringTokenizer(line); try { if (st.hasMoreTokens()) typ = st.nextToken(); if (st.hasMoreTokens()) x = Integer.parseInt(st.nextToken()); if (st.hasMoreTokens()) y = Integer.parseInt(st.nextToken()); if (typ.equals("rel")) f.moveRel(x, y); else if (typ.equals("abs")) f.moveAbs(x, y); else f.textOut(line); } catch (NumberFormatException e2) { f.textOut(line); } } } public void OpenFrame() { f = new BallFrame("Ball"); f.show(); } public Ball() { super(); OpenFrame(); } }