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

21
LINES

< > BotCompany Repo | #1007221 // tableSetColumnWidths

JavaX fragment (include)

sbool tableSetColumnWidths_debug;

static void tableSetColumnWidths(final JTable table, final Map<S, Int> widths) {
  swing { pcall {
    TableColumnModel tcm = table.getColumnModel();
    int n = tcm.getColumnCount();
    for i to n: {
      TableColumn tc = tcm.getColumn(i);
      Int w = widths.get(str(tc.getHeaderValue());
      if (w != null) {
        tc.setWidth(w);
        if (tableSetColumnWidths_debug)
          print("Setting width of column " + i + " to " + w);
      }
    }
  }}
}

static void tableSetColumnWidths(JTable table, O... widths) {
  tableSetColumnWidths(table, litorderedmap(widths));
}

Author comment

Began life as a copy of #1007220

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007221
Snippet name: tableSetColumnWidths
Eternal ID of this version: #1007221/13
Text MD5: 0a020f33162b4505707a2ade479259e3
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-23 21:01:13
Source code size: 639 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 443 / 413
Version history: 12 change(s)
Referenced in: [show references]