private void cmbTagsActionPerformed(ActionEvent e) { if (!editmode) return; if (txtTags.getText().isEmpty()) return; if (txtTags.getText().length() > 100) return; final String enteredText = SYSTools.tidy(txtTags.getText()).toLowerCase(); if (!addNewTags && !mapAllTags.containsKey(enteredText)) return; if (!mapAllTags.containsKey(enteredText)) { Commontags myNewCommontag = new Commontags(SYSTools.tidy(enteredText)); mapAllTags.put(enteredText, myNewCommontag); ac.uninstallListeners(); ac = new AutoCompletion(txtTags, mapAllTags.keySet().toArray(new String[] {})); ac.setStrict(false); ac.setStrictCompletion(false); } if (!listSelectedTags.contains(mapAllTags.get(enteredText))) { listSelectedTags.add(mapAllTags.get(enteredText)); SwingUtilities.invokeLater( () -> { if (listSelectedTags.size() % MAXLINE == 0) { add(createButton(mapAllTags.get(enteredText)), RiverLayout.LINE_BREAK); } else { add(createButton(mapAllTags.get(enteredText)), RiverLayout.LEFT); } txtTags.setText(""); revalidate(); repaint(); notifyListeners(mapAllTags.get(enteredText)); }); } }