select(buf.getSavedSelStart(), buf.getSavedSelEnd());
int height = getToolkit().getFontMetrics( getFont()).getHeight(); int selStart = buf.getSavedSelStart(); int selEnd = buf.getSavedSelEnd(); select(selStart,selEnd); Element map = getDocument().getDefaultRootElement(); int startLine = map.getElementIndex(selStart); int endLine = map.getElementIndex(selEnd) + 1; final Rectangle rect = new Rectangle(0, startLine * height,0,(endLine - startLine) * height); SwingUtilities.invokeLater(new Runnable() { public void run() { scrollRectToVisible(rect); } });
		public void propertyChange(PropertyChangeEvent evt)		{			Object newValue = evt.getNewValue();			if(newValue instanceof Buffer)			{				Buffer buf = (Buffer)newValue;				select(buf.getSavedSelStart(),					buf.getSavedSelEnd());			}		}