Libraryless. Click here for Pure Java version (2391L/16K).
1 | svoid jTextPane_adjustTextSizeToFillParentHeight(JTextPane pane, O... _) {
|
2 | if (pane == null || getParent(pane) == null || empty(getText(pane))) ret with callF(optPar onDone(_)); |
3 | if (jTextPane_shouldDecreaseFontSizeToFillParentHeight(pane)) |
4 | jTextPane_shrinkTextSizeToFillParentHeight(pane, _); |
5 | else if (jTextPane_shouldIncreaseFontSizeToFillParentHeight(pane)) swing {
|
6 | float size = pane.getFont().getSize2D(); |
7 | float newSize = size+1; |
8 | if (boolPar debug(_)) print("new font size: " + newSize);
|
9 | setFontSize(pane, newSize); |
10 | awtLater(optPar delay(_, 50), r {
|
11 | jTextPane_adjustTextSizeToFillParentHeight(pane, _); |
12 | }); |
13 | } |
14 | else |
15 | callF(optPar onDone(_)); |
16 | } |
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: | 477 / 674 |
| Version history: | 21 change(s) |
| Referenced in: | [show references] |