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

78
LINES

< > BotCompany Repo | #1006954 // onChange

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

Transpiled version (9573L) is out of date.

static <A extends JSpinner> A onChange(A spinner, O r) {
  ret onChange(spinner, toRunnable(r));
}

static <A extends JSpinner> A onChange(A spinner, Runnable r) {
  if (r != null)
    swing { spinner.addChangeListener(changeListener(r)); }
  ret spinner;
}

static <A extends AbstractButton> A onChange(A b, O r) {
  swing { b.addItemListener(itemListener(r)); }
  ret b;
}

static <A extends AbstractButton> A onChange(A b, Runnable r) {
  swing { b.addItemListener(itemListener(r)); }
  ret b;
}

svoid onChange(JTextComponent tc, O r) {
  onUpdate(tc, r);
}

svoid onChange(JTextComponent tc, Runnable r) {
  onUpdate(tc, r);
}

static <A extends JSlider> A onChange(A slider, Runnable r) {
  ret onChange(slider, (O) r);
}

static <A extends JSlider> A onChange(A slider, O r) {
  swing { slider.addChangeListener(changeListener(r)); }
  ret slider;
}

static <A> JComboBox<A> onChange(JComboBox<A> cb, Runnable r) {
  addActionListener(cb, r);
  ret cb;
}

static <A> JComboBox<A> onChange(JComboBox<A> cb, IVF1<A> f) {
  if (f != null) addActionListener(cb, -> f.get(getSelectedItem_typed(cb)));
  ret cb;
}

static JComboBox onChange(O r, JComboBox cb) {
  ret onChange(cb, r);
}

static JComboBox onChange(JComboBox cb, fO r) {
  if (isEditableComboBox(cb))
    onChange(textFieldFromComboBox(cb), r);
  else
    onSelectedItem(cb, voidfunc(S s) { callF(r) });
  ret cb;
}

static <A extends JTabbedPane> A onChange(A tabs, Runnable r) {
  swing { tabs.addChangeListener(changeListener(r)); }
  ret tabs;
}

static <A extends JColorChooser> A onChange(Runnable r, A cc) {
  if (cc != null && r != null) swing {
    cc.getSelectionModel().addChangeListener(changeListener(r));
  }
  ret cc;
}

svoid onChange(IHasChangeListeners a, ChangeTriggerable b) {
  if (a != null && b != null) a.onChange(new ChangeTrigger(b));
}

svoid onChange(IHasChangeListeners a, Runnable r) {
  if (a != null && r != null) a.onChange(r);
}

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/31
Text MD5: d0de8d16215086a21973140e3f876da8
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-21 08:28:47
Source code size: 2005 bytes / 78 lines
Pitched / IR pitched: No / No
Views / Downloads: 621 / 928
Version history: 30 change(s)
Referenced in: [show references]