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

1  
sclass BoolVarWithNotify extends BoolVar {
2  
  event fireChange;
3  
  
4  
  *() {}
5  
  *(bool value) { super(value); }
6  
  
7  
  @Override
8  
  public synchronized void set(bool 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 #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: 183 / 289
Version history: 4 change(s)
Referenced in: [show references]