Program: 86795
Project: 86795
Buggy source:
private void createUI(){
  this.panelView=new PanelView<>();
  this.optionsPanel=new Panel();
  this.keyInput=new KeyInput();
  this.keyInput.setDisabled(true);
  this.optionsPanel.addWidget(keyInput);
  Vector2f uiPos=new Vector2f(180,app.getScreenHeight() - 30);
  Button saveBtn=setupButton(uiPos,"String_Node_Str",false);
  saveBtn.getTextLabel().setFont(theme.getPrimaryFontName());
  saveBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      load=true;
      if (app.getTerminal().getInputText().equals("String_Node_Str")) {
        app.getTerminal().setInputText("String_Node_Str");
      }
    }
  }
);
  uiPos.x=app.getScreenWidth() - 140;
  Button cancelBtn=setupButton(uiPos,"String_Node_Str",false);
  cancelBtn.getTextLabel().setFont(theme.getPrimaryFontName());
  cancelBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      app.setScreen(menuScreen);
    }
  }
);
  Label headerLbl=new Label("String_Node_Str");
  headerLbl.setTheme(theme);
  headerLbl.setBounds(new Rectangle(0,50,app.getScreenWidth(),80));
  headerLbl.setTextAlignment(TextAlignment.CENTER);
  headerLbl.setFont(theme.getPrimaryFontName());
  headerLbl.setTextSize(54);
  uiPos.x=10;
  uiPos.y=120;
  setupLabel(uiPos,"String_Node_Str",true);
  final int startX=30;
  final int startY=160;
  final int yInc=20;
  final int xInc=100;
  final int toggleX=290;
  uiPos.x=startX;
  uiPos.y=startY;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  Button gameTypeBtn=setupButton(uiPos,this.gameSettings.gameType.name(),true);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  final Button mapBtn=setupButton(uiPos,gameSettings.currentMap,true);
  mapBtn.getBounds().setSize(340,30);
  mapBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      currentMapIndex++;
      if (currentMapIndex >= mapListings.size()) {
        currentMapIndex=0;
      }
      gameSettings.currentMap=mapListings.isEmpty() ? "String_Node_Str" : mapListings.get(currentMapIndex);
      mapBtn.setText(gameSettings.currentMap);
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label maxPlayersLbl=setupLabel(uiPos,Integer.toString(gameSettings.maxPlayers),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxPlayers--;
      int minSize=(gameSettings.axisTeam.size() + gameSettings.alliedTeam.size());
      if (gameSettings.maxPlayers < minSize) {
        gameSettings.maxPlayers=minSize;
      }
      maxPlayersLbl.setText(Integer.toString(gameSettings.maxPlayers));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxPlayers++;
      if (gameSettings.maxPlayers > 12) {
        gameSettings.maxPlayers=12;
      }
      maxPlayersLbl.setText(Integer.toString(gameSettings.maxPlayers));
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label maxScoreLbl=setupLabel(uiPos,Integer.toString(gameSettings.maxScore),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxScore--;
      if (gameSettings.maxScore < 1) {
        gameSettings.maxScore=1;
      }
      maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxScore++;
      maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label matchTimeLbl=setupLabel(uiPos,Long.toString(gameSettings.matchTime),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.matchTime--;
      if (gameSettings.matchTime < 1) {
        gameSettings.matchTime=1;
      }
      matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.matchTime++;
      matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
    }
  }
);
  gameTypeBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
switch (gameSettings.gameType) {
case OBJ:
        gameSettings.gameType=GameType.Type.TDM;
      gameSettings.matchTime=20;
    gameSettings.maxScore=50;
  break;
case TDM:
gameSettings.gameType=GameType.Type.OBJ;
gameSettings.matchTime=3;
gameSettings.maxScore=7;
break;
default :
gameSettings.gameType=GameType.Type.TDM;
break;
}
maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
event.getButton().setText(gameSettings.gameType.name());
}
}
);
uiPos.x=startX;
uiPos.y+=yInc;
Checkbox isDedicatedServer=new Checkbox(gameSettings.isDedicatedServer);
isDedicatedServer.setTheme(theme);
isDedicatedServer.setLabelText("String_Node_Str");
isDedicatedServer.getBounds().setLocation(uiPos);
isDedicatedServer.addCheckboxClickedListener(new OnCheckboxClickedListener(){
@Override public void onCheckboxClicked(CheckboxEvent event){
gameSettings.isDedicatedServer=event.getCheckbox().isChecked();
}
}
);
this.optionsPanel.addWidget(isDedicatedServer);
this.panelView.addElement(new CheckboxView(isDedicatedServer));
uiPos.x=10;
uiPos.y+=yInc * 2;
setupLabel(uiPos,"String_Node_Str",true);
uiPos.x=startX + 100;
uiPos.y+=yInc + 30;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.alliedTeam.size() > 0) {
gameSettings.alliedTeam.remove(gameSettings.alliedTeam.size() - 1);
refreshUI();
}
}
}
);
uiPos.x+=10;
uiPos.y-=20;
setupLabel(uiPos,"String_Node_Str",false);
uiPos.x+=100;
uiPos.y+=20;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() + gameSettings.alliedTeam.size() < gameSettings.maxPlayers - 1) {
String name=getNextRandomName();
gameSettings.alliedTeam.add(name);
refreshUI();
}
}
}
);
uiPos.x=550;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() > 0) {
gameSettings.axisTeam.remove(gameSettings.axisTeam.size() - 1);
refreshUI();
}
}
}
);
uiPos.x+=20;
uiPos.y-=20;
setupLabel(uiPos,"String_Node_Str",false);
uiPos.x+=90;
uiPos.y+=20;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() + gameSettings.alliedTeam.size() < gameSettings.maxPlayers - 1) {
String name=getNextRandomName();
gameSettings.axisTeam.add(name);
refreshUI();
}
}
}
);
uiPos.x=startX;
uiPos.y+=yInc;
createBotsPanel(uiPos);
this.panelView.addElement(new LabelView(headerLbl));
}

Fixed version (ground truth):
private void createUI(){
  this.panelView=new PanelView<>();
  this.optionsPanel=new Panel();
  this.keyInput=new KeyInput();
  this.keyInput.setDisabled(true);
  this.optionsPanel.addWidget(keyInput);
  Vector2f uiPos=new Vector2f(180,app.getScreenHeight() - 30);
  Button saveBtn=setupButton(uiPos,"String_Node_Str",false);
  saveBtn.getTextLabel().setFont(theme.getPrimaryFontName());
  saveBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      load=true;
      if (app.getTerminal().getInputText().equals("String_Node_Str")) {
        app.getTerminal().setInputText("String_Node_Str");
      }
    }
  }
);
  uiPos.x=app.getScreenWidth() - 140;
  Button cancelBtn=setupButton(uiPos,"String_Node_Str",false);
  cancelBtn.getTextLabel().setFont(theme.getPrimaryFontName());
  cancelBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      app.setScreen(menuScreen);
    }
  }
);
  Label headerLbl=new Label("String_Node_Str");
  headerLbl.setTheme(theme);
  headerLbl.setBounds(new Rectangle(0,50,app.getScreenWidth(),80));
  headerLbl.setTextAlignment(TextAlignment.CENTER);
  headerLbl.setFont(theme.getPrimaryFontName());
  headerLbl.setTextSize(54);
  uiPos.x=10;
  uiPos.y=120;
  setupLabel(uiPos,"String_Node_Str",true);
  final int startX=30;
  final int startY=160;
  final int yInc=20;
  final int xInc=100;
  final int toggleX=290;
  uiPos.x=startX;
  uiPos.y=startY;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  Button gameTypeBtn=setupButton(uiPos,this.gameSettings.gameType.name(),true);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  final Button mapBtn=setupButton(uiPos,gameSettings.currentMap,true);
  mapBtn.getBounds().setSize(340,30);
  mapBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      currentMapIndex++;
      if (currentMapIndex >= mapListings.size()) {
        currentMapIndex=0;
      }
      gameSettings.currentMap=mapListings.isEmpty() ? "String_Node_Str" : mapListings.get(currentMapIndex);
      mapBtn.setText(gameSettings.currentMap);
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label maxPlayersLbl=setupLabel(uiPos,Integer.toString(gameSettings.maxPlayers),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxPlayers--;
      int minSize=(gameSettings.axisTeam.size() + gameSettings.alliedTeam.size());
      if (gameSettings.maxPlayers < minSize) {
        gameSettings.maxPlayers=minSize;
      }
      maxPlayersLbl.setText(Integer.toString(gameSettings.maxPlayers));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.maxPlayers++;
      if (gameSettings.maxPlayers > 12) {
        gameSettings.maxPlayers=12;
      }
      maxPlayersLbl.setText(Integer.toString(gameSettings.maxPlayers));
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label maxScoreLbl=setupLabel(uiPos,Integer.toString(gameSettings.maxScore),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      if (gameSettings.gameType.equals(GameType.Type.OBJ)) {
        gameSettings.maxScore--;
        if (gameSettings.maxScore < 1) {
          gameSettings.maxScore=1;
        }
      }
 else {
        gameSettings.maxScore-=10;
        if (gameSettings.maxScore < 1) {
          gameSettings.maxScore=0;
        }
      }
      maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      if (gameSettings.gameType.equals(GameType.Type.OBJ)) {
        gameSettings.maxScore++;
      }
 else {
        gameSettings.maxScore+=10;
      }
      maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
    }
  }
);
  uiPos.x=startX;
  uiPos.y+=yInc;
  setupLabel(uiPos,"String_Node_Str",false);
  uiPos.x=toggleX + 30;
  final Label matchTimeLbl=setupLabel(uiPos,Long.toString(gameSettings.matchTime),false);
  uiPos.x=toggleX;
  uiPos.y+=yInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.matchTime--;
      if (gameSettings.matchTime < 1) {
        gameSettings.matchTime=1;
      }
      matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
    }
  }
);
  uiPos.x+=xInc;
  setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
      gameSettings.matchTime++;
      matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
    }
  }
);
  gameTypeBtn.addOnButtonClickedListener(new OnButtonClickedListener(){
    @Override public void onButtonClicked(    ButtonEvent event){
switch (gameSettings.gameType) {
case OBJ:
        gameSettings.gameType=GameType.Type.TDM;
      gameSettings.matchTime=20;
    gameSettings.maxScore=50;
  break;
case TDM:
gameSettings.gameType=GameType.Type.OBJ;
gameSettings.matchTime=3;
gameSettings.maxScore=7;
break;
default :
gameSettings.gameType=GameType.Type.TDM;
break;
}
maxScoreLbl.setText(Integer.toString(gameSettings.maxScore));
matchTimeLbl.setText(Long.toString(gameSettings.matchTime));
event.getButton().setText(gameSettings.gameType.name());
}
}
);
uiPos.x=startX;
uiPos.y+=yInc;
Checkbox isDedicatedServer=new Checkbox(gameSettings.isDedicatedServer);
isDedicatedServer.setTheme(theme);
isDedicatedServer.setLabelText("String_Node_Str");
isDedicatedServer.getBounds().setLocation(uiPos);
isDedicatedServer.addCheckboxClickedListener(new OnCheckboxClickedListener(){
@Override public void onCheckboxClicked(CheckboxEvent event){
gameSettings.isDedicatedServer=event.getCheckbox().isChecked();
}
}
);
this.optionsPanel.addWidget(isDedicatedServer);
this.panelView.addElement(new CheckboxView(isDedicatedServer));
uiPos.x=10;
uiPos.y+=yInc * 2;
setupLabel(uiPos,"String_Node_Str",true);
uiPos.x=startX + 100;
uiPos.y+=yInc + 30;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.alliedTeam.size() > 0) {
gameSettings.alliedTeam.remove(gameSettings.alliedTeam.size() - 1);
refreshUI();
}
}
}
);
uiPos.x+=10;
uiPos.y-=20;
setupLabel(uiPos,"String_Node_Str",false);
uiPos.x+=100;
uiPos.y+=20;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() + gameSettings.alliedTeam.size() < gameSettings.maxPlayers - 1) {
String name=getNextRandomName();
gameSettings.alliedTeam.add(name);
refreshUI();
}
}
}
);
uiPos.x=550;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() > 0) {
gameSettings.axisTeam.remove(gameSettings.axisTeam.size() - 1);
refreshUI();
}
}
}
);
uiPos.x+=20;
uiPos.y-=20;
setupLabel(uiPos,"String_Node_Str",false);
uiPos.x+=90;
uiPos.y+=20;
setupButton(uiPos,"String_Node_Str",true).addOnButtonClickedListener(new OnButtonClickedListener(){
@Override public void onButtonClicked(ButtonEvent event){
if (gameSettings.axisTeam.size() + gameSettings.alliedTeam.size() < gameSettings.maxPlayers - 1) {
String name=getNextRandomName();
gameSettings.axisTeam.add(name);
refreshUI();
}
}
}
);
uiPos.x=startX;
uiPos.y+=yInc;
createBotsPanel(uiPos);
this.panelView.addElement(new LabelView(headerLbl));
}