Пример #1
0
  private void removeAllButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();

    selectedRobots.clear();
    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    showInstructions();
  }
Пример #2
0
  private void removeButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();
    int sel[] = selectedList.getSelectedIndices();

    for (int i = 0; i < sel.length; i++) {
      selectedRobots.remove(sel[i] - i);
    }
    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    if (selectedModel.getSize() < minRobots || selectedModel.getSize() > maxRobots) {
      showWrongNumInstructions();
    } else {
      showInstructions();
    }
  }
Пример #3
0
  private void addButtonActionPerformed() {
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) getSelectedRobotsList().getModel();
    List<AvailableRobotsPanel.ItemWrapper> moves = availableRobotsPanel.getSelectedRobots();

    for (AvailableRobotsPanel.ItemWrapper move : moves) {
      selectedRobots.add(new AvailableRobotsPanel.ItemWrapper(move.getItem()));
    }

    selectedModel.changed();
    fireStateChanged();
    if (selectedModel.getSize() >= minRobots && selectedModel.getSize() <= maxRobots) {
      showInstructions();
    } else if (selectedModel.getSize() > maxRobots) {
      showWrongNumInstructions();
    }

    availableRobotsPanel.getAvailableRobotsList().requestFocus();
  }
Пример #4
0
  private void addAllButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();

    for (AvailableRobotsPanel.ItemWrapper selected : availableRobotsPanel.getAvailableRobots()) {
      selectedRobots.add(selected);
    }

    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    if (selectedModel.getSize() >= minRobots && selectedModel.getSize() <= maxRobots) {
      showInstructions();
    } else if (selectedModel.getSize() > maxRobots) {
      showWrongNumInstructions();
    }

    availableRobotsPanel.getAvailableRobotsList().requestFocus();
  }