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

20
LINES

< > BotCompany Repo | #1035745 // DoubleVarWithNotify

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

Libraryless. Click here for Pure Java version (9649L/54K).

sclass DoubleVarWithNotify extends DoubleVar {
  event fireChange;
  
  *() {}
  *(double value) { super(value); }
  
  @Override
  public synchronized void set(double 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 #1034280

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035745
Snippet name: DoubleVarWithNotify
Eternal ID of this version: #1035745/1
Text MD5: 0724580dbfab2c875f2729d649f1ccf9
Transpilation MD5: e4dd14436314e4b4cf66234cf95b7684
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-19 19:39:36
Source code size: 352 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 164 / 223
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)