|
@@ -1,5 +1,7 @@
|
|
|
package animation;
|
|
|
|
|
|
+import java.awt.Rectangle;
|
|
|
+
|
|
|
import javax.swing.JTree;
|
|
|
import javax.swing.SwingUtilities;
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
@@ -124,6 +126,16 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
|
|
|
this.selected = selected;
|
|
|
if( selected )
|
|
|
{
|
|
|
+ if( tree != null ) {
|
|
|
+ TreePath path = new TreePath( getPath() );
|
|
|
+ Rectangle bounds = tree.getPathBounds(path);
|
|
|
+ if( bounds!= null )
|
|
|
+ {
|
|
|
+ bounds.height = (int) (tree.getVisibleRect().height - tree.getVisibleRect().getHeight() / 2);
|
|
|
+ bounds.x = 0;
|
|
|
+ tree.scrollRectToVisible(bounds);
|
|
|
+ }
|
|
|
+ }
|
|
|
if( controller == null || controller.getStepOption() != 1 || breakPoint )
|
|
|
{
|
|
|
SwingUtilities.invokeLater( new Runnable() {
|