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).

!752

// these don't work:
//   <html><center><font size="20">Font size 20!</font></center></html>
//   <html><p align=center><font size="20">Font size 20!</font></
//   <html><div style="text-align: center;"><font size="20">Font size 20!</font></div></html>

// This works - but you have to center the whole thing too (in JLabel constructor)
//   <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>

static S html = [[
  <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>
 ]];


p {
  makeFrame(new JLabel(html.trim(), JLabel.CENTER)); // trim is important!
}

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: 674 / 724
Referenced in: [show references]