Libraryless. Click here for Pure Java version (2288L/16K/53K).
1 | !752 |
2 | |
3 | // these don't work: |
4 | // <html><center><font size="20">Font size 20!</font></center></html> |
5 | // <html><p align=center><font size="20">Font size 20!</font></ |
6 | // <html><div style="text-align: center;"><font size="20">Font size 20!</font></div></html> |
7 | |
8 | // This works - but you have to center the whole thing too (in JLabel constructor) |
9 | // <html> <head></head> <body> <div style="text-align: center;">Bringen Sie die Komponenten in die richtige Reihenfolge! <br> Zeile 2<br> Zeile 3 </div></body> </html> |
10 | |
11 | static S html = [[ |
12 | <html> <head></head> <body> <div style="text-align: center;">Bringen Sie die Komponenten in die richtige Reihenfolge! <br> Zeile 2<br> Zeile 3 </div></body> </html> |
13 | ]]; |
14 | |
15 | |
16 | p { |
17 | JLabel l = new JLabel(html.trim(), JLabel.CENTER); // trim is important! |
18 | l.setVerticalAlignment(l.TOP); |
19 | makeFrame(l); |
20 | } |
Began life as a copy of #1000923
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000925 |
Snippet name: | JLabel with HTML content (font size 20 centered X, top Y) |
Eternal ID of this version: | #1000925/1 |
Text MD5: | 72ab9b05c8db34e398a3388567948576 |
Transpilation MD5: | 1363fe413a477c90856bc5a8b43041aa |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-09-02 17:29:51 |
Source code size: | 857 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 653 / 656 |
Referenced in: | [show references] |