diff --git a/src/MainWindow.java b/src/MainWindow.java index 8a97378..dc24cc0 100644 --- a/src/MainWindow.java +++ b/src/MainWindow.java @@ -117,6 +117,9 @@ JOptionPane.PLAIN_MESSAGE); } + /** + * This class will listen for button actions. + */ private class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { @@ -140,6 +143,9 @@ } } + /** + * Refresh the list on the screen. + */ private void updateList() { model = new DefaultListModel(); for (String s : this.elementList.getAllElementsAsStrings()) { @@ -148,6 +154,9 @@ lstElementsList.setModel(model); } + /** + * Add an element to the list. + */ private void addElement() { if (!txtInputField.getText().equals("")) { if (txtInputField.getText().contains(",")) { @@ -160,20 +169,32 @@ } } + /** + * Remove an element from the list. + */ private void removeElement() { elementList.removeAt(elementList.find(lstElementsList.getSelectedValue())); updateList(); } + /** + * Remove all elements from the list. + */ private void clearAllElements() { elementList.clear(); updateList(); } + /** + * Find the first element that matches in the list. + */ private void findElement() { lstElementsList.setSelectedValue(txtInputField.getText(), true);; } + /** + * Append a list of items separated by commas to the current list. + */ private void appendList() { String[] elements = txtInputField.getText().split(","); IList elementList = new List();