Java JLabel,其中HTML包含<&引用;及&燃气轮机&引用;人物

Java JLabel,其中HTML包含<&引用;及&燃气轮机&引用;人物,java,html,swing,special-characters,jlabel,Java,Html,Swing,Special Characters,Jlabel,我经常在JavaSwing的JLabels中使用HTML。最后,我遇到了一些让我困惑的事情 我的代码: public static void main(String[] args) { JFrame frame = new JFrame(); BoxLayout layout = new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS); frame.getContentPane().se

我经常在JavaSwing的JLabels中使用HTML。最后,我遇到了一些让我困惑的事情

我的代码:

public static void main(String[] args) {
        JFrame frame = new JFrame();
        BoxLayout layout = new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS);
        frame.getContentPane().setLayout(layout);
        JLabel lbl1 = new JLabel("<html>Label 1: 300 > 100 and 90 < 200 </html>");
        JLabel lbl2 = new JLabel("<html>Label 2: 300 &gt; 100 and 90 &lt; 200 </html>");
        JLabel lbl3 = new JLabel("<html>Label 3: 300 \u003E 100 and 90 \u003C 200 </html>");
        frame.add(lbl1);
        frame.add(lbl2);
        frame.add(lbl3);
        frame.pack();
        frame.setVisible(true);
    }
publicstaticvoidmain(字符串[]args){
JFrame=新JFrame();
BoxLayout布局=新的BoxLayout(frame.getContentPane(),BoxLayout.PAGE_轴);
frame.getContentPane().setLayout(布局);
JLabel lbl1=新的JLabel(“标签1:300>100和90<200”);
JLabel lbl2=新的JLabel(“标签2:300 100和90 200”);
JLabel lbl3=新的JLabel(“标签3:300\u003E 100和90\u003C 200”);
帧。添加(lbl1);
帧。添加(lbl2);
帧。添加(lbl3);
frame.pack();
frame.setVisible(true);
}

有人能解释一下为什么在标签1和3中我看到
“>”
字符,,而
”,这也是HTML中的一个特殊字符,被显示出来吗


<
>
是唯一正确的选项吗?

JLabel实现采用原始

据了解,你是对的。这两个是普遍接受的

表示小于

表示大于

Are &lt; and &gt; the only correct options?