/** @description Method to do a search and populate the results panel with the search result */ public void search() { /* Search for the specified user */ Collection<StorageEntry> results = null; try { results = cUserProfile .getNode() .get(Profile.generateKey(keywordTF.getText()), Profile.type, null, true, 5) .get(); } catch (InterruptedException | ExecutionException ie) { System.err.println("Searcher Interrupted"); } /* Now we display the result onto the result panel */ StorageEntry profileSE = null; long recency = 0; for (StorageEntry e : results) { /* Select the most recent result */ if (e.getSubmissionTime() > recency) { recency = e.getSubmissionTime(); profileSE = e; } } /* Add this friend's profile to the frame */ resultsPanel.add(new UserDisplay(profileSE)); /* Refresh the frame */ frame.repaint(); frame.revalidate(); }