Go Back   Cloud Computing > General Discussion > General Discussion Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-07, 07:04
BOD Member
 
Join Date: May 2007
Posts: 81
Smile This is useful for developers who need html related features in their labels

This Java Swing tip illustrates a JLabel that uses inline HTML to format its text. This may be useful for developers who need html related features in their labels.
import javax.swing.*;

public class HtmlLabel extends JPanel {

public static final String markup =
"< html >line 1< p >< font color=blue size=+2 >"
+ "big blue< /font > line 2< p >line 3< /html >";

public static void main(String argv[]) {
JPanel p = new JPanel(new java.awt.GridLayout(0, 1));
p.add(new JLabel(markup));
p.add(new java.awt.Label(markup));

JFrame f = new JFrame("HtmlLabel");
f.setContentPane(p);
f.setSize(600, 200);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 16:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.