1 | static JWindow screenTextOverlay_withOutline_multiLine(fS text, O... _) {
|
2 | ret swing(func -> JWindow {
|
3 | new JWindow w; |
4 | w.setAlwaysOnTop(true); |
5 | w.setVisible(true); |
6 | |
7 | Font font = cast optPar font(_); |
8 | if (font == null) |
9 | font = w.getFont().deriveFont(boolPar bold(_, true) ? Font.BOLD : Font.PLAIN, optPar fontSize(_, 80)); |
10 | Pair<Shape, Rect> shapeAndSize = textLayoutToOutlineAndSize_multiLine(text, font, w); |
11 | |
12 | float outlineWidth = optPar outlineWidth(_, 4.0f); |
13 | JComponent c = dynamicallyPaintedComponent(voidfunc(Graphics2D g, int w, int h) {
|
14 | fillRect(g, 0, 0, w, h, optPar color(_, Color.WHITE)); |
15 | g.setColor(Color.black); |
16 | g.setStroke(new BasicStroke(outlineWidth); |
17 | antiAliasOn(g); |
18 | g.draw(shapeAndSize.a); |
19 | }); |
20 | w.add(c); |
21 | |
22 | centerWindow(w, iceil(shapeAndSize.b.w+optPar magicXMargin(_, 10)), |
23 | iceil(shapeAndSize.b.h+optPar magicYMargin(_, 10))); |
24 | w.setShape(shapeAndSize.a); |
25 | ret w; |
26 | }); |
27 | } |
Began life as a copy of #1023016
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: | #1023070 |
| Snippet name: | screenTextOverlay_withOutline_multiLine [left aligned, WORKS] |
| Eternal ID of this version: | #1023070/5 |
| Text MD5: | 25ac99c3eecc7e48f11d2e93859bc799 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-04-30 20:47:39 |
| Source code size: | 1004 bytes / 27 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 455 / 516 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |