resize import dialog up but not down to avoid having the checkboxes jump around on the screen when clicked

This commit is contained in:
myk
2013-03-20 22:49:28 +00:00
parent 4034544216
commit e5abecafce

View File

@@ -645,6 +645,9 @@ public class DialogMigrateProfile {
private boolean _isOverwrite; private boolean _isOverwrite;
private boolean _stop; private boolean _stop;
// only accessed from the event loop thread
int _maxLogLength = 0;
public _OperationLogAsyncUpdater(Map<OpType, Pair<FCheckBox, ? extends Map<File, File>>> selections, JTextArea operationLog) { public _OperationLogAsyncUpdater(Map<OpType, Pair<FCheckBox, ? extends Map<File, File>>> selections, JTextArea operationLog) {
super("OperationLogUpdater"); super("OperationLogUpdater");
setDaemon(true); setDaemon(true);
@@ -730,14 +733,20 @@ public class DialogMigrateProfile {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
String logText = log.toString();
// setText is thread-safe, but the resizing is not, so might as well do this in the swing event loop thread // setText is thread-safe, but the resizing is not, so might as well do this in the swing event loop thread
_operationLog.setText(log.toString()); _operationLog.setText(log.toString());
// resize the panel properly for the new log contents if (_maxLogLength < logText.length()) {
_selectionPanel.getParent().validate(); _maxLogLength = logText.length();
_selectionPanel.getParent().invalidate();
_topPanel.getParent().validate(); // resize the panel properly for the new log contents
_topPanel.getParent().invalidate(); _selectionPanel.getParent().validate();
_selectionPanel.getParent().invalidate();
_topPanel.getParent().validate();
_topPanel.getParent().invalidate();
}
} }
}); });
} }