java里面除了使用Graphics里面的setcolor方法改变字体颜色外,还有没有其他方法
来源:百度知道 编辑:UC知道 时间:2024/05/26 22:00:41
如果我想把HELLO中国改成一个变量怎么改
import javax.swing.*;
public class TestLabel extends JFrame {
private JLabel l =new JLabel();
public TestLabel()
{
this.setSize(600,400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
l.setText("<html><font color=red size=30>Hello 中国</font></html>");//设置Label的显示内容
this.add(l,"North");
this.setTitle("Label Test");
this.setVisible(true);
}
public static void main(String[] args) {
new TestLabel();
}
}
只知道Label可以用HTML,包含,可以解释。看看上面的代码。
不知道其他的控件怎么样!没去试过!
有呀,上色.