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

16
LINES

< > BotCompany Repo | #1023001 // jTextPane_adjustTextSizeToFillParentHeight - TODO: single word/few long words

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

Libraryless. Click here for Pure Java version (2391L/16K).

svoid jTextPane_adjustTextSizeToFillParentHeight(JTextPane pane, O... _) {
  if (pane == null || getParent(pane) == null || empty(getText(pane))) ret with callF(optPar onDone(_));
  if (jTextPane_shouldDecreaseFontSizeToFillParentHeight(pane))
    jTextPane_shrinkTextSizeToFillParentHeight(pane, _);
  else if (jTextPane_shouldIncreaseFontSizeToFillParentHeight(pane)) swing {
    float size = pane.getFont().getSize2D();
    float newSize = size+1;
    if (boolPar debug(_)) print("new font size: " + newSize);
    setFontSize(pane, newSize);
    awtLater(optPar delay(_, 50), r {
      jTextPane_adjustTextSizeToFillParentHeight(pane, _);
    });
  }
  else
    callF(optPar onDone(_));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1023001
Snippet name: jTextPane_adjustTextSizeToFillParentHeight - TODO: single word/few long words
Eternal ID of this version: #1023001/22
Text MD5: ebd2e737c356d45d2f356528f0e41b11
Transpilation MD5: 3bcfe83a30c8228d2643f5e8624dff27
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-20 00:58:54
Source code size: 706 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 279 / 420
Version history: 21 change(s)
Referenced in: [show references]