1 | svoid jTextPane_shrinkTextSizeToFillParentHeight(JTextPane pane, O... _) { |
2 | if (pane == null || getParent(pane) == null) ret with callF(optPar onDone(_)); |
3 | swing { |
4 | int pref = preferredHeight(pane); |
5 | int h = getParentHeight(pane); |
6 | double ratio = doubleRatio(h, pref); |
7 | if (ratio >= 1) ret with callF(optPar onDone(_)); |
8 | float size = pane.getFont().getSize2D(); |
9 | float newSize = size-1; |
10 | if (boolPar debug(_)) print("pref=" + pref + ", h=" + h + ", new font size: " + newSize); |
11 | setFontSize(pane, newSize); |
12 | awtLater(optPar delay(_, 50), r { |
13 | jTextPane_shrinkTextSizeToFillParentHeight(pane, _); |
14 | }); |
15 | } |
16 | } |
Began life as a copy of #1023001
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: | #1023004 |
Snippet name: | jTextPane_shrinkTextSizeToFillParentHeight |
Eternal ID of this version: | #1023004/7 |
Text MD5: | eeea52f8e79fafeeec1a5907bdee6481 |
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:34 |
Source code size: | 658 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 243 / 305 |
Version history: | 6 change(s) |
Referenced in: | [show references] |