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(); }
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(); }
private void selectedRobotsListSelectionChanged() { int sel[] = getSelectedRobotsList().getSelectedIndices(); if (sel.length == 1) { availableRobotsPanel.clearSelection(); IRobotSpecItem robotSpecification = ((AvailableRobotsPanel.ItemWrapper) getSelectedRobotsList().getModel().getElementAt(sel[0])) .getItem(); showDescription(robotSpecification); } else { showDescription(null); } }