private void listOfNamesValueChanged(javax.swing.event.ListSelectionEvent evt) { // TODO add your handling code here: int index = listOfNames.getSelectedIndex(); // System.out.println(index); listModel3.clear(); listModel4.clear(); for (int i = 0; i < 5; i++) { listModel3.addElement((answers.get(index))[i]); } answerList.setModel(listModel3); for (int i = 0; i < 5; i++) { if ((answers.get(index))[i] == correct[i]) { listModel4.addElement("2/2"); } else { listModel4.addElement("0/2"); } } pointList.setModel(listModel4); }
protected void reset() { fCounterPanel.reset(); fProgressIndicator.reset(); fFailureView.clear(); fFailures.clear(); }
private void updateHints() { String text = classSearchField.getText().trim(); // Ignore empty text if (text.trim().length() == 0) { hideHints(); return; } // Updating hints window if needed if (!CompareUtils.equals(lastSearchedText, text)) { // Saving old selection Object oldSelection = classSearchHintsList.getSelectedValue(); // Clearing list DefaultListModel model = (DefaultListModel) classSearchHintsList.getModel(); model.clear(); // Look for classes List<JarEntry> found = jarStructure.findSimilarEntries( text, new Filter<JarEntry>() { @Override public boolean accept(JarEntry object) { return object.getType().equals(JarEntryType.javaEntry); } }); if (found.size() > 0) { classSearchField.setForeground(Color.BLACK); // Filling list with results for (JarEntry entry : found) { model.addElement(entry); } // Updating visible rows classSearchHintsList.setVisibleRowCount(Math.min(model.size(), 10)); // Restoring selection if possible int index = oldSelection != null ? model.indexOf(oldSelection) : 0; classSearchHintsList.setSelectedIndex(index != -1 ? index : 0); // Packing popup classSearchHintsPopup.pack(); // Displaying hints window if (!classSearchHintsPopup.isVisible()) { classSearchHintsPopup.setVisible(true); } } else { classSearchField.setForeground(Color.RED); // Hiding hints window if (classSearchHintsPopup.isVisible()) { classSearchHintsPopup.setVisible(false); } } lastSearchedText = text; } }