Example #1
0
 @Override
 public void focusLost(final FocusEvent e) {
   final Object source = e.getSource();
   if (source instanceof FTextField) { // the text box
     final FTextField nField = (FTextField) source;
     final String newName = nField.getText().trim();
     if (index == 0
         && !StringUtils.isBlank(newName)
         && StringUtils.isAlphanumericSpace(newName)
         && prefs.getPref(FPref.PLAYER_NAME) != newName) {
       prefs.setPref(FPref.PLAYER_NAME, newName);
       prefs.save();
     }
     lobby.firePlayerChangeListener(index);
   }
 }
Example #2
0
 @Override
 public void handleEvent(FEvent e) {
   final Object source = e.getSource();
   if (source instanceof FTextField) { // the text box
     FTextField nField = (FTextField) source;
     String newName = nField.getText().trim();
     if (index == 0
         && !StringUtils.isBlank(newName)
         && StringUtils.isAlphanumericSpace(newName)
         && prefs.getPref(FPref.PLAYER_NAME) != newName) {
       prefs.setPref(FPref.PLAYER_NAME, newName);
       prefs.save();
       if (allowNetworking) {
         screen.firePlayerChangeListener(index);
       }
     }
   }
 }
Example #3
0
 String getPlayerName() {
   return txtPlayerName.getText();
 }