[Pogamut-list] Server classes

carlos.junior pogamut-forum at artemis.ms.mff.cuni.cz
Wed May 14 21:21:55 CEST 2008


Re: Server classes
The code I wrote to test is below:

public class Test {

	public static void main(String a[]) {

		UTServer server = null;
		URI uri = null;
		
		try {
			uri = new URI("ut://localhost:3000");
		} catch (URISyntaxException ex) {
			ex.printStackTrace();
			JOptionPane.showMessageDialog(null, "URI unavailable!");
			System.exit(1);
		}
		
		server = new UTServer();
		server.setGamebotsControlConnectionURI(uri);
		server.setGamebotsBotURI(uri);
		server.connect();

                // Learner Bot is a subclass of Agent
		final LearnerBot agent = new LearnerBot();
		agent.getCurrentState().setRunning(true);

		try {
			server.connectBot(agent, "Learner_Bot");
		} catch (PogamutException ex) {
			ex.printStackTrace();
		}

		JFrame f = new JFrame();
		f.setSize(300, 550);
		f.setVisible(true);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		MouseAdapter mouseListener = new                                 BotControllerMouseListener(agent);
		KeyAdapter keyListener = new BotControllerKeyListener(agent);
		f.addMouseListener(mouseListener);
		f.addMouseMotionListener(mouseListener);
		f.addKeyListener(keyListener);

	}

Maybe the code may help to understand my problem.

----

Reply Link: <https://artemis.ms.mff.cuni.cz/pogamut/tiki-view_forum_thread.php?forumId=5&comments_reply_threadId=183&comments_parentId=182&post_reply=1#form>





More information about the Pogamut-list mailing list