diff options
Diffstat (limited to 'src/cuchaz/enigma/gui/Gui.java')
| -rw-r--r-- | src/cuchaz/enigma/gui/Gui.java | 16 |
1 files changed, 13 insertions, 3 deletions
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; | |||
| 54 | import javax.swing.JTree; | 54 | import javax.swing.JTree; |
| 55 | import javax.swing.KeyStroke; | 55 | import javax.swing.KeyStroke; |
| 56 | import javax.swing.ListSelectionModel; | 56 | import javax.swing.ListSelectionModel; |
| 57 | import javax.swing.SwingUtilities; | ||
| 57 | import javax.swing.Timer; | 58 | import javax.swing.Timer; |
| 58 | import javax.swing.WindowConstants; | 59 | import javax.swing.WindowConstants; |
| 59 | import javax.swing.event.CaretEvent; | 60 | import javax.swing.event.CaretEvent; |
| @@ -776,9 +777,16 @@ public class Gui | |||
| 776 | // make sure the token is visible in the scroll window | 777 | // make sure the token is visible in the scroll window |
| 777 | Rectangle start = m_editor.modelToView( token.start ); | 778 | Rectangle start = m_editor.modelToView( token.start ); |
| 778 | Rectangle end = m_editor.modelToView( token.end ); | 779 | Rectangle end = m_editor.modelToView( token.end ); |
| 779 | Rectangle show = start.union( end ); | 780 | final Rectangle show = start.union( end ); |
| 780 | show.grow( 0, start.height*6 ); | 781 | show.grow( start.width*10, start.height*6 ); |
| 781 | m_editor.scrollRectToVisible( show ); | 782 | SwingUtilities.invokeLater( new Runnable( ) |
| 783 | { | ||
| 784 | @Override | ||
| 785 | public void run( ) | ||
| 786 | { | ||
| 787 | m_editor.scrollRectToVisible( show ); | ||
| 788 | } | ||
| 789 | } ); | ||
| 782 | } | 790 | } |
| 783 | catch( BadLocationException ex ) | 791 | catch( BadLocationException ex ) |
| 784 | { | 792 | { |
| @@ -818,6 +826,8 @@ public class Gui | |||
| 818 | } | 826 | } |
| 819 | } ); | 827 | } ); |
| 820 | timer.start(); | 828 | timer.start(); |
| 829 | |||
| 830 | redraw(); | ||
| 821 | } | 831 | } |
| 822 | 832 | ||
| 823 | public void showTokens( Collection<Token> tokens ) | 833 | public void showTokens( Collection<Token> tokens ) |