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

18
LINES

< > BotCompany Repo | #1004327 // selectRow - select row in a JTable or JList

JavaX fragment (include)

static void selectRow(final JTable table, final int i) {
  if (table != null) swing {
    if (i >= 0 && i < table.getRowCount()) {
      table.setRowSelectionInterval(i, i);
      scrollRowToVisible(table, i);
    } else
      table.clearSelection();
  }
}

static void selectRow(final JList list, final int i) {
  if (list != null) swing {
    if (i >= 0 && i < listRowCount(list))
      list.setSelectedIndex(i);
    else
      list.clearSelection();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004327
Snippet name: selectRow - select row in a JTable or JList
Eternal ID of this version: #1004327/6
Text MD5: 01b9eafc1549db4356a1d2b34b6ef0a7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-31 16:49:30
Source code size: 475 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 609 / 636
Version history: 5 change(s)
Referenced in: [show references]