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

25
LINES

< > BotCompany Repo | #1020001 // Set Preferred Way Of Shutting Off Computer [Shutdown Method] - or do it now

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (9411L/50K).

1  
!7
2  
3  
cmodule PreferredShutDownMethod {
4  
  transient LS entries = ll("Power Off", "Suspend to RAM", "Suspend to disk", "Never shut down");
5  
  
6  
  visualize {
7  
    ButtonGroup buttons = jUnselectedRadioButtons(entries);
8  
    selectRadioButton(buttons, indexOfIC(entries, trim(loadTextFile(preferredShutDownMethodFile()))));
9  
    onRadioButtonChange(buttons, voidfunc(int i) {
10  
      S method = _get(entries, i);
11  
      saveTextFile(preferredShutDownMethodFile(), method);
12  
      infoBox("Preferred shutdown method changed to: " + method);
13  
    });
14  
    ret centerAndSouthWithMargins(jSection("PREFERRED WAY", jfullcenter(vstackWithSpacing(buttonsInGroup(buttons)))),
15  
      vstackWithSpacing(
16  
        jbutton("Do it now", rThread doPreferredComputerShutDown),
17  
        jPopDownButton("Do something else once",
18  
          position := 'center,
19  
          "Power Off", rThread cleanPowerOff,
20  
          "Reboot", rThread cleanReboot,
21  
          "Suspend to RAM", rThread suspendToRAM,
22  
          "Suspend to disk", rThread suspendToDisk,
23  
          "Log out", rThread os_logOut)));
24  
  }
25  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020001
Snippet name: Set Preferred Way Of Shutting Off Computer [Shutdown Method] - or do it now
Eternal ID of this version: #1020001/15
Text MD5: 61be4f3883ed01c44bed5f7ba2ce515d
Transpilation MD5: 75bb7ef1c301eb902e3d70c01f517350
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-15 14:45:07
Source code size: 1086 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 259 / 1307
Version history: 14 change(s)
Referenced in: [show references]