Libraryless. Click here for Pure Java version (11110L/62K).
1 | static <A extends JSpinner> A onChange(A spinner, O r) { |
2 | ret onChange(spinner, toRunnable(r)); |
3 | } |
4 | |
5 | static <A extends JSpinner> A onChange(A spinner, Runnable r) { |
6 | if (r != null) |
7 | swing { spinner.addChangeListener(changeListener(r)); } |
8 | ret spinner; |
9 | } |
10 | |
11 | static <A extends AbstractButton> A onChange(A b, Runnable r) { |
12 | swing { b.addItemListener(itemListener(r)); } |
13 | ret b; |
14 | } |
15 | |
16 | svoid onChange(JTextComponent tc, Runnable r) { |
17 | onUpdate(tc, r); |
18 | } |
19 | |
20 | static <A extends JSlider> A onChange(A slider, Runnable r) { |
21 | swing { slider.addChangeListener(changeListener(r)); } |
22 | ret slider; |
23 | } |
24 | |
25 | static <A> JComboBox<A> onChange(JComboBox<A> cb, ChangeTriggerable r) { |
26 | ret onChange(cb, new ChangeTrigger(r)); |
27 | } |
28 | |
29 | static <A> JComboBox<A> onChange(JComboBox<A> cb, Updateable r) { |
30 | ret onChange(cb, new UpdateTrigger(r)); |
31 | } |
32 | |
33 | static <A> JComboBox<A> onChange(JComboBox<A> cb, IVF1<A> f) { |
34 | if (f != null) addActionListener(cb, -> f.get(getSelectedItem_typed(cb))); |
35 | ret cb; |
36 | } |
37 | |
38 | // Note: JComboBox also supports addActionListener. |
39 | // Not sure if that would help us any. |
40 | static JComboBox onChange(JComboBox cb, Runnable r) { |
41 | if (isEditableComboBox(cb)) |
42 | onChange(textFieldFromComboBox(cb), r); |
43 | else |
44 | onSelectedItem(cb, runnableToIVF1(r)); |
45 | ret cb; |
46 | } |
47 | |
48 | static <A extends JTabbedPane> A onChange(A tabs, Runnable r) { |
49 | swing { tabs.addChangeListener(changeListener(r)); } |
50 | ret tabs; |
51 | } |
52 | |
53 | static <A extends JColorChooser> A onChange(Runnable r, A cc) { |
54 | if (cc != null && r != null) swing { |
55 | cc.getSelectionModel().addChangeListener(changeListener(r)); |
56 | } |
57 | ret cc; |
58 | } |
59 | |
60 | static <A extends IHasChangeListeners> A onChange(A a, ChangeTriggerable b) { |
61 | if (a != null && b != null) a.onChange(new ChangeTrigger(b)); |
62 | ret a; |
63 | } |
64 | |
65 | static <A extends IHasChangeListeners> A onChange(A a, Updateable b) { |
66 | if (a != null && b != null) a.onChange(new UpdateTrigger(b)); |
67 | ret a; |
68 | } |
69 | |
70 | static <A extends IHasChangeListeners> A onChange(A a, Runnable r) { |
71 | if (a != null && r != null) a.onChange(r); |
72 | ret a; |
73 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006954 |
Snippet name: | onChange |
Eternal ID of this version: | #1006954/38 |
Text MD5: | 738c31ac4606598a1ee48156ee5c5684 |
Transpilation MD5: | ac978fd6fdd3a0015b4c1588f96e4718 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-05-05 09:01:59 |
Source code size: | 2069 bytes / 73 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 827 / 1244 |
Version history: | 37 change(s) |
Referenced in: | [show references] |