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


< > 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 843K of libraries. Click here for Pure Java version (9411L/50K).


cmodule PreferredShutDownMethod {
  transient LS entries = ll("Power Off", "Suspend to RAM", "Suspend to disk", "Never shut down");
  visualize {
    ButtonGroup buttons = jUnselectedRadioButtons(entries);
    selectRadioButton(buttons, indexOfIC(entries, trim(loadTextFile(preferredShutDownMethodFile()))));
    onRadioButtonChange(buttons, voidfunc(int i) {
      S method = _get(entries, i);
      saveTextFile(preferredShutDownMethodFile(), method);
      infoBox("Preferred shutdown method changed to: " + method);
    ret centerAndSouthWithMargins(jSection("PREFERRED WAY", jfullcenter(vstackWithSpacing(buttonsInGroup(buttons)))),
        jbutton("Do it now", rThread doPreferredComputerShutDown),
        jPopDownButton("Do something else once",
          position := 'center,
          "Power Off", rThread cleanPowerOff,
          "Reboot", rThread cleanReboot,
          "Suspend to RAM", rThread suspendToRAM,
          "Suspend to disk", rThread suspendToDisk,
          "Log out", rThread os_logOut)));

download  show line numbers  debug dex   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz

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: 116 / 781
Version history: 14 change(s)
Referenced in: [show references]

Formerly at &