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

18
LINES

< > BotCompany Repo | #1000923 // JLabel with HTML content (centered X and Y)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1283L/9K/29K).

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  
  makeFrame(new JLabel(html.trim(), JLabel.CENTER)); // trim is important!
18  
}

Author comment

Began life as a copy of #1000922

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: #1000923
Snippet name: JLabel with HTML content (centered X and Y)
Eternal ID of this version: #1000923/1
Text MD5: dc2ac231ee08bd8df226b322c66f9bab
Transpilation MD5: 5897f83299ad94889eb503bac2938b44
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-03 16:19:48
Source code size: 806 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 675 / 727
Referenced in: [show references]