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

29
LINES

< > BotCompany Repo | #1034180 // tempProgressBar_addToWindowIfPossible

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

Libraryless. Click here for Pure Java version (12539L/73K).

meta-for JWindow also as JFrame {

  static IProgressShower tempProgressBar_addToWindowIfPossible(JWindow window, S text, double total default 1) {
    if (!isVisibleWindow(window)) ret tempProgressBar(text, total);
    
    JProgressBar bar = jProgressBarWithText(iround(total), text);
    var closeable = tempAddToWindow(window,
      withMargin(jCenteredRaisedSection(text, bar)));
    
    ret new IProgressShower {
      public void setValue(double value) {
        setProgressBarValue(bar, iround(value));
      }
      
      public void setTotal(double total) {
        setProgressBarTotal(bar, iround(total));
      }
      
      public void setText(S text) {
        setProgressBarText(bar, print(text));
      }
      
      public void close {
        _close(closeable);
      }
    };
  }
  
}

Author comment

Began life as a copy of #1022691

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034180
Snippet name: tempProgressBar_addToWindowIfPossible
Eternal ID of this version: #1034180/3
Text MD5: 86406aa214cd248160a43e1f952eda13
Transpilation MD5: c2c42c62ba1714def1a9a61096e4e120
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-25 21:36:11
Source code size: 835 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 82 / 149
Version history: 2 change(s)
Referenced in: [show references]