void drawLine(int lno) { if (lno < 0 || lno >= text.getLineCount()) return; int y = text.getLocationAtOffset(text.getOffsetAtLine(lno)).y; int height = 0; if (text.getLineCount() > lno + 1) height = text.getLocationAtOffset(text.getOffsetAtLine(lno + 1)).y - y; else height = text.getLocationAtOffset(text.getCharCount()).y + text.getLineHeight(); int width = text.getClientArea().width + text.getHorizontalPixel(); text.redraw(0, y, width, height, false); }
void updateViewport() { baseEditor.lineCountEvent(text.getLineCount()); int start = 0; try { start = text.getTopIndex() - 1; } catch (Exception e) { e.printStackTrace(System.out); } if (start < 0) start = 0; int end = start + text.getClientArea().height / text.getLineHeight(); baseEditor.visibleTextEvent(start, end - start + 2); }