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

15
LINES

< > BotCompany Repo | #1016595 // tableDependentButton_extraCondition - enable button when an item is selected in a JTable

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9753L/54K).

static JButton tableDependentButton_extraCondition(JTable table, S text, O action, F0<Bool> extraCondition) {
  final JButton b = jbutton(text, action);
  onTableSelectionChangedAndNow(table, r {
    b.setEnabled(table.getSelectedRow() >= 0 && isTrue(callF(extraCondition)))
  });
  ret b;
}

static JButton tableDependentButton_extraCondition(JTable table, IF0<Bool> extraCondition, S text, Runnable action) {
  JButton b = jbutton(text, action);
  onTableSelectionChangedAndNow(table, r {
    b.setEnabled(table.getSelectedRow() >= 0 && (extraCondition == null || extraCondition!));
  });
  ret b;
}

Author comment

Began life as a copy of #1016591

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016595
Snippet name: tableDependentButton_extraCondition - enable button when an item is selected in a JTable
Eternal ID of this version: #1016595/4
Text MD5: b96fc16e76c58c09eb5e3034e455d50e
Transpilation MD5: 22d74ac9fa2ef39e5635e856be1ad26f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-30 19:03:24
Source code size: 615 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 353 / 434
Version history: 3 change(s)
Referenced in: [show references]