UI thread invoke fixes/improvements

This commit is contained in:
honfika@gmail.com
2016-12-28 11:21:13 +01:00
parent e6377fcf98
commit 5b0bd1f0c5
15 changed files with 1574 additions and 1421 deletions

View File

@@ -87,6 +87,8 @@ public class SearchPanel<E> extends JPanel {
}
public boolean setResults(List<E> results) {
View.checkAccess();
found = results;
if (found.isEmpty()) {
setVisible(false);
@@ -104,20 +106,24 @@ public class SearchPanel<E> extends JPanel {
}
public void setPos(int pos) {
View.checkAccess();
foundPos = pos;
doUpdate();
}
public void clear() {
View.checkAccess();
foundPos = 0;
found.clear();
}
private void doUpdate() {
View.execInEventDispatchLater(() -> {
searchPos.setText((foundPos + 1) + "/" + found.size());
listener.updateSearchPos(found.get(foundPos));
});
View.checkAccess();
searchPos.setText((foundPos + 1) + "/" + found.size());
listener.updateSearchPos(found.get(foundPos));
}
private void cancelButtonActionPerformed(ActionEvent evt) {