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

24
LINES

< > BotCompany Repo | #1004995 // fillTableWithData (strings, images, bools) - now makes table uneditable

JavaX fragment (include)

1  
static void fillTableWithData(final JTable table, L<L> rows, L<S> colNames) {
2  
  fillTableWithData(table, rows, toStringArray(colNames));
3  
}
4  
5  
// thread-safe
6  
static void fillTableWithData(final JTable table, L<L> rows, S... colNames) {
7  
  final DefaultTableModel model = fillTableWithData_makeModel(rows, colNames);
8  
  
9  
  // TODO: keep model if columns identical?
10  
  setTableModel(table, model);
11  
}
12  
13  
static DefaultTableModel fillTableWithData_makeModel(L<L> rows, S... colNames) {
14  
  Pair<Object[][], O[]> p = fillTableWithData_makeData(rows, colNames);
15  
  ret new DefaultTableModel(p.a, p.b) {
16  
    public Class getColumnClass(int column) {
17  
      return or(_getClass(getValueAt(0, column)), S.class);
18  
    }
19  
    
20  
    public bool isCellEditable(int rowIndex, int columnIndex) {
21  
      ret false;
22  
    }
23  
  };
24  
}

Author comment

Began life as a copy of #1001438

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: #1004995
Snippet name: fillTableWithData (strings, images, bools) - now makes table uneditable
Eternal ID of this version: #1004995/10
Text MD5: 57ea3413414432b12254a68a49cf9750
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-07 00:14:13
Source code size: 821 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 568 / 572
Version history: 9 change(s)
Referenced in: [show references]