static void textComponentDependButtons(final JTextComponent tc, L<? extends Component> buttons) { for (Component c : buttons) if (c instanceof JButton) { final JButton b = cast c; tc.addCaretListener(new CaretListener { public void caretUpdate(CaretEvent e) { b.setEnabled(tc.getSelectionEnd() > tc.getSelectionStart()); } }); b.setEnabled(tc.getSelectionEnd() > tc.getSelectionStart()); } }
Began life as a copy of #1004936
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005049 |
Snippet name: | textComponentDependButtons |
Eternal ID of this version: | #1005049/1 |
Text MD5: | 9fcbe2830b7c6734859d239552455ab3 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-03 20:31:25 |
Source code size: | 462 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 619 / 601 |
Referenced in: | [show references] |