Fixed swing syncing bugs
This commit is contained in:
@@ -219,8 +219,8 @@ implements ProgressProviderListener, Runnable, DoingDoneListener<Task> {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(this::dispose);
|
||||
suc = true;
|
||||
this.dispose();
|
||||
HMCLog.log("Tasks are finished.");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class CollectionUtils {
|
||||
|
||||
public static <T> ArrayList<T> map(Collection<T> coll, Predicate<T> p) {
|
||||
ArrayList<T> newColl = new ArrayList<>();
|
||||
Observable.from(coll).filter(p).subscribe(newColl::add);
|
||||
Observable.from(coll).filter(t -> p.apply(t)).subscribe(t -> newColl.add(t));
|
||||
return newColl;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SwingUtils {
|
||||
char[] chars = longString.toCharArray();
|
||||
FontMetrics fontMetrics = jLabel1.getFontMetrics(jLabel1.getFont());
|
||||
for (int beginIndex = 0, limit = 1;; limit++) {
|
||||
if (beginIndex + limit >= chars.length)
|
||||
if (beginIndex + limit > chars.length)
|
||||
break;
|
||||
if (fontMetrics.charsWidth(chars, beginIndex, limit) < jLabel1.getWidth()) {
|
||||
if (beginIndex + limit < chars.length)
|
||||
|
||||
Reference in New Issue
Block a user