Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1036479 // scrollTextAreaToLineAndCol

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (9941L) is out of date.

1  
svoid scrollTextAreaToLineAndCol(JTextArea ta, LineAndColumn lac) {
2  
  pcall swing ctex {
3  
    int pos = ta.getLineStartOffset(lac.line-1)+lac.col-1;
4  
    Rectangle viewRect = ta.modelToView(pos);
5  
    printVars("scrollTextAreaToLineAndCol", +lac, +pos, +viewRect);
6  
    if (viewRect != null)
7  
      setEnclosingViewPosition(ta, viewRect.x, viewRect.y);
8  
  }
9  
}

Author comment

Began life as a copy of #1035160

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036479
Snippet name: scrollTextAreaToLineAndCol
Eternal ID of this version: #1036479/7
Text MD5: 807078e89b2a2186bdcb558c3a6e8ccd
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-17 17:01:28
Source code size: 361 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 77 / 123
Version history: 6 change(s)
Referenced in: [show references]