Libraryless. Click here for Pure Java version (1534L/10K/34K).
!747 !actionListener { !awt { !pcall m { static JTable tbl; static new L data; p { data = (L) unstructure(loadSnippet("#1001610"), true); JFrame frame = new JFrame("A Table"); frame.setBounds(10, 10, 400, 400); tbl = new JTable(); updateTable(); frame.getContentPane().add(new JScrollPane(tbl)); frame.setVisible(true); } static void updateTable() { new L<L<S>> rows; new L<S> cols; if (data != null) for (O x : data) pcall { if (x instanceof DynamicObject) { DynamicObject dO = cast x; new L<S> row; for (S field : dO.fieldValues.keySet()) { O value = dO.fieldValues.get(field); int col = cols.indexOf(field); if (col < 0) { cols.add(field); col = cols.size()-1; } dynSet(row, col, value instanceof S ? (S) value : structure(value)); } rows.add(row); } else rows.add(litlist("?")); } fillTableWithStrings(tbl, rows, cols); } static void dynSet(L<S> l, int i, S s) { while (i >= l.size()) l.add(""); l.set(i, s); } }
Began life as a copy of #1001437 Seems to work.
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
1154 | stefan | See #1001612 | 2015-10-28 18:13:38 |
Snippet ID: | #1001611 |
Snippet name: | Swing: Show arbitrary Java list as table |
Eternal ID of this version: | #1001611/1 |
Text MD5: | 14fed563b57a175081ec6a79fcc2689e |
Transpilation MD5: | 3ab2dad07aa15f911976ffac9625d535 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-10-28 18:13:44 |
Source code size: | 1239 bytes / 53 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 828 / 870 |
Referenced in: | [show references] |