SwingUtilities.invokeLater(new Runnable() { public void run() { int height = getToolkit().getFontMetrics( getFont()).getHeight(); int y = Math.max(0,rect.y - height * electricLines); int lines = height * electricLines * 2; if(y + lines + rect.height <= getHeight()) { rect.y = y; rect.height += lines; } scrollRectToVisible(rect); } });
SwingUtilities.invokeLater(new SyntaxSafeScroller(rect));
		public void adjustVisibility(final Rectangle rect)		{			SwingUtilities.invokeLater(new Runnable() {				public void run()				{					int height = getToolkit().getFontMetrics(						getFont()).getHeight();					int y = Math.max(0,rect.y - height						* electricLines);					int lines = height * electricLines * 2;					if(y + lines + rect.height <= getHeight())					{						rect.y = y;						rect.height += lines;					}					scrollRectToVisible(rect);				}			});		}