[Commit] RRClient RRBoardPanel.java,1.9,1.10 RRClient.java,1.6,1.7

Bart Massey commit at keithp.com
Sat Jun 14 19:36:13 PDT 2003


Committed by: bart

Update of /local/src/CVS/RRClient
In directory home.keithp.com:/tmp/cvs-serv3419

Modified Files:
	RRBoardPanel.java RRClient.java 
Log Message:
Added a little more gui.



Index: RRBoardPanel.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRBoardPanel.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- RRBoardPanel.java	9 Jun 2003 03:11:07 -0000	1.9
+++ RRBoardPanel.java	15 Jun 2003 01:36:11 -0000	1.10
@@ -29,8 +29,6 @@
     }
 
     public void mousePressed(MouseEvent e) {
-	if (!ctl.board.getActive())
-	    return;
 	if (e.getButton() != e.BUTTON1)
 	    return;
 	start = ctl.boardPanel.boardCoord(e.getPoint());

Index: RRClient.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRClient.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- RRClient.java	9 Jun 2003 01:54:45 -0000	1.6
+++ RRClient.java	15 Jun 2003 01:36:11 -0000	1.7
@@ -28,7 +28,7 @@
 	    System.err.println("connection error");
 	    return;
 	}
-	RRController ctl = new RRController();
+	final RRController ctl = new RRController();
 	try {
 	    ctl.netout = new RRNetOut(s, ctl);
 	    ctl.board = new RRBoard(ctl, null);
@@ -39,6 +39,17 @@
 	    System.err.println("could not connect to host");
 	    return;
 	}
+	String[] intstrings = {"3", "4", "5", "6", "7", "8", "9", "10"};
+	JComboBox bidPanel = new JComboBox(intstrings);
+	class BidListener implements ActionListener {
+	    public void actionPerformed(ActionEvent e) {
+		JComboBox b = (JComboBox) e.getSource();
+		ctl.netout.bid(Integer.parseInt((String)(b.getSelectedItem())) + 3);
+	    }
+	};
+	BidListener bid_listener = new BidListener();
+	bidPanel.addActionListener(bid_listener);
+	getContentPane().add(bidPanel, BorderLayout.EAST);
         getContentPane().add(ctl.boardPanel, BorderLayout.CENTER);
 	ctl.netin.start();
     }
@@ -46,7 +57,7 @@
     public static void main(String[] args)
       throws IOException {
     	Socket s = new Socket(args[0], 5252);
-	RRController ctl = new RRController();
+	final RRController ctl = new RRController();
 	ctl.netout = new RRNetOut(s, ctl);
 	ctl.board = new RRBoard(ctl, args[1]);
 	ctl.images = new RRImages(Toolkit.getDefaultToolkit());
@@ -60,12 +71,30 @@
             });
 
         f.getContentPane().add(ctl.boardPanel, BorderLayout.CENTER);
+	String[] intstrings = {"3", "4", "5", "6", "7", "8", "9", "10"};
+	JComboBox bidBox = new JComboBox(intstrings);
+	class BidListener implements ActionListener {
+	    public void actionPerformed(ActionEvent e) {
+		JComboBox b = (JComboBox) e.getSource();
+		ctl.netout.bid(Integer.parseInt((String)(b.getSelectedItem())) + 3);
+	    }
+	};
+	BidListener bid_listener = new BidListener();
+	bidBox.addActionListener(bid_listener);
+	JPanel bidPanel = new JPanel();
+	bidPanel.setLayout(new BoxLayout(bidPanel, BoxLayout.Y_AXIS));
+	bidPanel.add(bidBox);
+	f.getContentPane().add(bidPanel, BorderLayout.EAST);
+
         f.setSize(new Dimension(496,496));
         f.setVisible(true);
 
 	ctl.netin.start();
-	ctl.netout.hello(args[1]);
-	ctl.netout.watch(args[2]);
+	ctl.netout.hello(args[2]);
+	if (args[1].equals("watch"))
+	     ctl.netout.watch(args[3]);
+	else if (args[1].equals("join"))
+	     ctl.netout.join(args[3]);
 	ctl.netout.show();
     }
 




More information about the Commit mailing list