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

10
LINES

< > BotCompany Repo | #1024181 // selectTableRows - select rows in a JTable [dev.]

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

Libraryless. Click here for Pure Java version (2025L/13K).

1  
svoid selectTableRows(final JTable table, int[] rows) {
2  
  if (table != null) swing {
3  
    ListSelectionModel model = table.getSelectionModel();
4  
    int n = tableRows(table);
5  
    model.clearSelection();
6  
    if (rows != null) for (int row : rows)
7  
      if (row < n)
8  
        model.addSelectionInterval(row, row);
9  
  }
10  
}

Author comment

Began life as a copy of #1004327

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024181
Snippet name: selectTableRows - select rows in a JTable [dev.]
Eternal ID of this version: #1024181/3
Text MD5: 5c0760ab873c975a8f418bc16e0a0c6c
Transpilation MD5: f4bc084205b013bb35ad0d3db27e542a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-24 15:58:07
Source code size: 323 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 445
Version history: 2 change(s)
Referenced in: [show references]