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).

svoid selectTableRows(final JTable table, int[] rows) {
  if (table != null) swing {
    ListSelectionModel model = table.getSelectionModel();
    int n = tableRows(table);
    model.clearSelection();
    if (rows != null) for (int row : rows)
      if (row < n)
        model.addSelectionInterval(row, row);
  }
}

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: 336 / 444
Version history: 2 change(s)
Referenced in: [show references]