MCPcopy Create free account
hub / github.com/catabriga/graphwar / actionPerformed

Method actionPerformed

src/Graphwar/MainMenuScreen.java:325–480  ·  view source on GitHub ↗
(ActionEvent arg0)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 12

showJoinGlobalMethod · 0.95
showMessageMethod · 0.95
showCreateGameMethod · 0.95
showJoinGameMethod · 0.95
joinGlobalMethod · 0.80
createGameMethod · 0.80
getGameDataMethod · 0.80
joinGameMethod · 0.80
setScreenMethod · 0.80
getUIMethod · 0.80
addPlayerMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected