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).

1  
sclass DoubleVarWithNotify extends DoubleVar {
2  
  event fireChange;
3  
  
4  
  *() {}
5  
  *(double value) { super(value); }
6  
  
7  
  @Override
8  
  public synchronized void set(double a) {
9  
    if (get() != a) {
10  
      super.set(a);
11  
      fireChange();
12  
    }
13  
  }
14  
  
15  
  selfType onChangeAndNow(Runnable r) {
16  
    onChange(r);
17  
    r.run();
18  
    this;
19  
  }
20  
}

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: 163 / 223
Referenced in: [show references]