السلام عليكم
هذه لمحة كيفية صنع Swing JLabel يمكننها تضمن تنسيق HTML في نصها
و قد تكون مفيدة للمبرمجين اللذين يهتمون بتنسشق ال HTML في برامجهم
import javax.swing.*;
/**
* 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.
* @author mersan
*/
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<p><font color=red size=+4>Big Red</font></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, 300);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}ارجو ان تكون مفيدة
