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

1  
scope stefansOS_loadingAnimation.
2  
3  
sbool #fullScreen;
4  
sS #text = "Stefan's OS loading";
5  
sS #animationID = #1101325; //#1101279;
6  
7  
static JFrame stefansOS_loadingAnimation(Runnable onStop) {
8  
  ret stefansOS_loadingAnimation(onStop, null);
9  
}
10  
11  
static JFrame stefansOS_loadingAnimation(final Runnable onStop, LiveValue<S> lvDetails) {
12  
  if (headless()) null;
13  
  print("[loading animation]");
14  
  final JLabel label = jcenteredlabel(text);
15  
  final JButton stopButton = jbutton(upper("Press space to stop"), r {
16  
    disableButton();
17  
    //setText(heldInstance(JButton), "Stopping...");
18  
    setText(label, "STOPPING");
19  
    callF(onStop);
20  
  });
21  
  logMechListAppendLocally("Animations shown", animationID);
22  
  JComponent anim;
23  
  {
24  
    temp tempSetThreadLocal(imageIcon_fixGIF, false);
25  
    anim = jimage(animationID);
26  
  }
27  
  JPanel panel = jBackground(Color.black, centerAndSouth(centerAndSouth(
28  
    withMargin(50, anim),
29  
    withMargin(20, 40, 0, 40, setForeground(Color.white, setFont(#1011145, 60, label)))),
30  
    withMargin(0, 20, 20, 20, 
31  
      northAndCenter(
32  
        withBottomMargin(30, setForeground(Color.white, jCenteredLiveValueLabel(lvDetails))),
33  
        jcenteredline(stopButton)))));
34  
  if (fullScreen)
35  
    ret showFullScreen(panel);
36  
  else
37  
    ret onWindowClosingOnly(showCenterPackedFrame(text, panel), rClickButton(stopButton));
38  
}
39  
40  
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: 471 / 558
Version history: 22 change(s)
Referenced in: [show references]