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

20
LINES

< > BotCompany Repo | #1034280 // BoolVarWithNotify

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

Libraryless. Click here for Pure Java version (5647L/31K).

sclass BoolVarWithNotify extends BoolVar {
  event fireChange;
  
  *() {}
  *(bool value) { super(value); }
  
  @Override
  public synchronized void set(bool a) {
    if (get() != a) {
      super.set(a);
      fireChange();
    }
  }
  
  selfType onChangeAndNow(Runnable r) {
    onChange(r);
    r.run();
    this;
  }
}

Author comment

Began life as a copy of #1034091

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034280
Snippet name: BoolVarWithNotify
Eternal ID of this version: #1034280/5
Text MD5: d770640d8e587d5bfc4a8591691dbbe6
Transpilation MD5: 4aaf0eeafe1579ccb7a43dcf11d9fe8a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-31 21:29:00
Source code size: 344 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 287
Version history: 4 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)
#1035745 - DoubleVarWithNotify