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

34
LINES

< > BotCompany Repo | #1007651 // onChangeAndNow - synonym of onUpdateAndNow (for JTextComponent, JCheckBox and others)

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

Transpiled version (8355L) is out of date.

// action = runnable or method name
static void onChangeAndNow(JComponent c, O r) {
  onUpdateAndNow(c, r);
}

static void onChangeAndNow(L<? extends JComponent> l, O r) {
  onUpdateAndNow(l, r);
}

svoid onChangeAndNow(JTextComponent c, IVF1<S> r) {
  onUpdateAndNow(c, r);
}

static <A> JComboBox<A> onChangeAndNow(JComboBox<A> cb, IVF1<A> f) {
  onChange(cb, f);
  f?.get(getSelectedItem_typed(cb));
  ret cb;
}

static <A extends JTabbedPane> A onChangeAndNow(A tabs, Runnable r) {
  if (r != null) {
    onChange(tabs, r);
    r.run();
  }
  ret tabs;
}

static JSlider onChangeAndNow(JSlider s, Runnable f) {
  if (s != null && f != null) {
    onChange(s, f);
    f.run();
  }
  ret s;
}

Author comment

Began life as a copy of #1006125

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: #1007651
Snippet name: onChangeAndNow - synonym of onUpdateAndNow (for JTextComponent, JCheckBox and others)
Eternal ID of this version: #1007651/15
Text MD5: e87d1cedef1e288216dbc022200d86c3
Author: stefan
Category: javax swing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-10 19:23:42
Source code size: 729 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 613 / 745
Version history: 14 change(s)
Referenced in: [show references]