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

40
LINES

< > BotCompany Repo | #1016004 // stefansOS_loadingAnimation

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (8206L/60K).

scope stefansOS_loadingAnimation.

sbool #fullScreen;
sS #text = "Stefan's OS loading";
sS #animationID = #1101325; //#1101279;

static JFrame stefansOS_loadingAnimation(Runnable onStop) {
  ret stefansOS_loadingAnimation(onStop, null);
}

static JFrame stefansOS_loadingAnimation(final Runnable onStop, LiveValue<S> lvDetails) {
  if (headless()) null;
  print("[loading animation]");
  final JLabel label = jcenteredlabel(text);
  final JButton stopButton = jbutton(upper("Press space to stop"), r {
    disableButton();
    //setText(heldInstance(JButton), "Stopping...");
    setText(label, "STOPPING");
    callF(onStop);
  });
  logMechListAppendLocally("Animations shown", animationID);
  JComponent anim;
  {
    temp tempSetThreadLocal(imageIcon_fixGIF, false);
    anim = jimage(animationID);
  }
  JPanel panel = jBackground(Color.black, centerAndSouth(centerAndSouth(
    withMargin(50, anim),
    withMargin(20, 40, 0, 40, setForeground(Color.white, setFont(#1011145, 60, label)))),
    withMargin(0, 20, 20, 20, 
      northAndCenter(
        withBottomMargin(30, setForeground(Color.white, jCenteredLiveValueLabel(lvDetails))),
        jcenteredline(stopButton)))));
  if (fullScreen)
    ret showFullScreen(panel);
  else
    ret onWindowClosingOnly(showCenterPackedFrame(text, panel), rClickButton(stopButton));
}

end scope

Author comment

Began life as a copy of #1015998

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016004
Snippet name: stefansOS_loadingAnimation
Eternal ID of this version: #1016004/23
Text MD5: a33802492b8bc9eda22435eacc37c22c
Transpilation MD5: d6d90e0917836a02b6480ab87cace542
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-24 04:50:26
Source code size: 1380 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 472 / 560
Version history: 22 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)