* fix potential layout issues (especially on Windows where scroll bars tends to be missing in certain situations)
This commit is contained in:
parent
3a6a56458a
commit
6abb001249
|
@ -37,15 +37,15 @@ class RenameList<E> extends FileBotList<E> {
|
||||||
list.setFixedCellHeight(28);
|
list.setFixedCellHeight(28);
|
||||||
list.getModel().addListDataListener(new ListDataListener() {
|
list.getModel().addListDataListener(new ListDataListener() {
|
||||||
|
|
||||||
private int longestItem = -1;
|
private int longestItemLength = -1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void intervalRemoved(ListDataEvent evt) {
|
public void intervalRemoved(ListDataEvent evt) {
|
||||||
// reset prototype value
|
// reset prototype value
|
||||||
ListModel<?> m = (ListModel<?>) evt.getSource();
|
ListModel<?> m = (ListModel<?>) evt.getSource();
|
||||||
if (m.getSize() == 0) {
|
if (m.getSize() == 0) {
|
||||||
|
longestItemLength = -1;
|
||||||
list.setPrototypeCellValue(null);
|
list.setPrototypeCellValue(null);
|
||||||
longestItem = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +60,14 @@ class RenameList<E> extends FileBotList<E> {
|
||||||
for (int i = evt.getIndex0(); i <= evt.getIndex1() && i < m.getSize(); i++) {
|
for (int i = evt.getIndex0(); i <= evt.getIndex1() && i < m.getSize(); i++) {
|
||||||
Object item = m.getElementAt(i);
|
Object item = m.getElementAt(i);
|
||||||
int itemLength = item.toString().length();
|
int itemLength = item.toString().length();
|
||||||
if (itemLength > longestItem) {
|
if (itemLength > longestItemLength) {
|
||||||
|
// cell values will not be updated if the prototype object remains the same (even if the object has changed) so we need to reset it
|
||||||
|
if (item == list.getPrototypeCellValue()) {
|
||||||
|
list.setPrototypeCellValue("");
|
||||||
|
}
|
||||||
|
|
||||||
|
longestItemLength = itemLength;
|
||||||
list.setPrototypeCellValue(item);
|
list.setPrototypeCellValue(item);
|
||||||
longestItem = itemLength;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue