Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //editor is jtextarea
- Rectangle r = editor.getVisibleRect();
- Point top = new Point(r.x, r.y);
- Point bottom = new Point(r.x, r.y + r.height);
- int startRow = editor.viewToModel(top); // this is working. it shows 0 at initial, then after the line reaches the end and when the scrollbar gets displayed, it shows the numbers correctly, 1,2,3...
- int endRow = editor.viewToModel(bottom); // this is not working, when we type, it is taking column numbers
- editorLineNo.setText(" START ROW " + startRow + " END ROW" + endRow);
- What is needed is, start row number and end row number from the jtextarea
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement