From b4b9f296e9bcdbfcabb1cf49885a1747ce094c61 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 22 Aug 2014 01:41:41 -0400 Subject: fixed recursion of field reference nodes tweaked scroll into view for showing tokens --- src/cuchaz/enigma/gui/Gui.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/cuchaz/enigma/gui/Gui.java') diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java index 914359b..dd82b8e 100644 --- a/src/cuchaz/enigma/gui/Gui.java +++ b/src/cuchaz/enigma/gui/Gui.java @@ -54,6 +54,7 @@ import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.WindowConstants; import javax.swing.event.CaretEvent; @@ -776,9 +777,16 @@ public class Gui // make sure the token is visible in the scroll window Rectangle start = m_editor.modelToView( token.start ); Rectangle end = m_editor.modelToView( token.end ); - Rectangle show = start.union( end ); - show.grow( 0, start.height*6 ); - m_editor.scrollRectToVisible( show ); + final Rectangle show = start.union( end ); + show.grow( start.width*10, start.height*6 ); + SwingUtilities.invokeLater( new Runnable( ) + { + @Override + public void run( ) + { + m_editor.scrollRectToVisible( show ); + } + } ); } catch( BadLocationException ex ) { @@ -818,6 +826,8 @@ public class Gui } } ); timer.start(); + + redraw(); } public void showTokens( Collection tokens ) -- cgit v1.2.3