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

20
LINES

< > BotCompany Repo | #1000925 // JLabel with HTML content (font size 20 centered X, top Y)

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

Libraryless. Click here for Pure Java version (2288L/16K/53K).

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

Author comment

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: 654 / 658
Referenced in: #3000190 - Answer for stefanreich(>> t 20 questions)
#3000382 - Answer for ferdie (>> t = 1, f = 0)