(ActionEvent arg0)
| 323 | } |
| 324 | |
| 325 | public void actionPerformed(ActionEvent arg0) |
| 326 | { |
| 327 | if(this.joinGlobalVisible) |
| 328 | { |
| 329 | if(arg0.getSource()==this.noButtonGlobal) |
| 330 | { |
| 331 | this.showJoinGlobal(false); |
| 332 | this.showMessage = false; |
| 333 | this.repaint(); |
| 334 | } |
| 335 | else if(arg0.getSource()==this.yesButtonGlobal || arg0.getSource()==nameFieldGlobal) |
| 336 | { |
| 337 | String name = nameFieldGlobal.getText(); |
| 338 | |
| 339 | if(name!=null && name.length()>0) |
| 340 | { |
| 341 | if(name.length() > 20) |
| 342 | { |
| 343 | nameFieldGlobal.setText(name.substring(0,20)); |
| 344 | } |
| 345 | else |
| 346 | { |
| 347 | this.showMessage("Connecting..."); |
| 348 | |
| 349 | try |
| 350 | { |
| 351 | graphwar.joinGlobal(name); |
| 352 | this.showJoinGlobal(false); |
| 353 | this.showMessage = false; |
| 354 | } |
| 355 | catch (IOException e) |
| 356 | { |
| 357 | this.showMessage("Could not connect."); |
| 358 | |
| 359 | e.printStackTrace(); |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | else if(this.createVisible) |
| 366 | { |
| 367 | if(arg0.getSource()==this.noButtonCreate) |
| 368 | { |
| 369 | this.showCreateGame(false); |
| 370 | this.showMessage = false; |
| 371 | this.repaint(); |
| 372 | } |
| 373 | else if(arg0.getSource()==this.yesButtonCreate || arg0.getSource()==nameFieldCreate || arg0.getSource()==portFieldCreate) |
| 374 | { |
| 375 | try |
| 376 | { |
| 377 | String name = nameFieldCreate.getText(); |
| 378 | int port = Integer.parseInt(portFieldCreate.getText()); |
| 379 | |
| 380 | if(name!=null && name.length()!=0) |
| 381 | { |
| 382 | if(name.length() > 20) |
nothing calls this directly
no test coverage detected