mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 21:51:56 +00:00
better way to scroll the selected view to visible
This commit is contained in:
@@ -162,6 +162,8 @@ import java.awt.dnd.DragSourceListener;
|
||||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.dnd.DropTargetDropEvent;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -533,6 +535,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
});
|
||||
|
||||
tagTree.addComponentListener(new ComponentAdapter() {
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
tagTree.scrollPathToVisible(tagTree.getSelectionPath());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
DragSource dragSource = DragSource.getDefaultDragSource();
|
||||
dragSource.createDefaultDragGestureRecognizer(tagTree, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
|
||||
@Override
|
||||
@@ -2635,23 +2646,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else {
|
||||
if (!detailPanel.isVisible()) {
|
||||
detailPanel.setVisible(true);
|
||||
|
||||
new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
View.execInEventDispatch(() -> {
|
||||
tagTree.scrollPathToVisible(tagTree.getSelectionPath());
|
||||
});
|
||||
}
|
||||
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user