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

37
LINES

< > BotCompany Repo | #1023954 // agi.blue Control Panel [for standalone version]

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

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

!7

cmodule AgiBlueControlPanel {
  transient JLabel lblStarted;
  transient JButton btnStart;
  S port = "8080";
  
  visualize {
    if (getOpt(agiProg(), 'webServerPorts) == null) ret jcenteredlabel("Not running agi.blue");
    
    ret makeForm(
      "Web Server Started:", lblStarted = jlabel(yesNo(started())),
      "HTTP Port:", dm_inputField('port),
      "", " ",
      "", btnStart = setEnabled(!started(), makeBold(jButtonWithInset("Start Web Server", rThread startWebServer))),
      "", " ",
      "", jbutton("Open In Browser", rThread openInBrowser));
  }
  
  void startWebServer enter {
    set(agiProg(), webServerPorts := new int[] { parseInt(port) });
    disableButton(btnStart);
    temp tempSetButtonText(btnStart, "Starting...");
    call(agiProg(), 'startEleu);
    setText(lblStarted, yesNo(started()));
  }
  
  bool started() { ret isTrue(get(agiProg(), 'started)); }
  
  O agiProg() { ret mainProgram(); }
  
  bool warnOnDelete() { true; }
  
  void openInBrowser enter {
    openURLInBrowser("http://localhost:" + parseInt(port));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023954
Snippet name: agi.blue Control Panel [for standalone version]
Eternal ID of this version: #1023954/15
Text MD5: e304c53e2d62e6814458f1dc69b651e6
Transpilation MD5: 18e24943beb62a8587e976a980030989
Author: stefan
Category: javax / agi.blue
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-14 12:28:29
Source code size: 1106 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 558
Version history: 14 change(s)
Referenced in: [show references]