在线等待!!
import java.awt.*;
import javax.swing.*;
import java.io.*;
class FontColor{
public static void main(String args []) throws Exception{
JFrame f=new JFrame("Mytest");
f.setForeground(new Color(255,0,0));
f.setBackground(new Color(255,0,255));
f.getContentPane().setLayout(new FlowLayout());
JLabel t1=new JLabel("Dialog,Font.BOLD+Font.ITALIC");
Font f1=new Font("Dialog",Font.BOLD+Font.ITALIC,50);
t1.setFont(f1);
f.getContentPane().add(t1);
JLabel t2=new JLabel("DialogInput,Font.BOLD");
Font f2=new Font("DialogInput",Font.BOLD,60);
t2.setFont(f2);
f.getContentPane().add(t2);
JLabel t3=new JLabel("Serif,Font.PLAIN");
Font f3=new Font("Serif",Font.PLAIN,70);
t3.setFont(f3);
f.getContentPane().add(t3);
f.setSize(250,250);
f.pack();
f.setVisible(true);
}
}
为什么修改Color();的参数以后颜色不发生变发呢?
告诉小弟!!谢谢!!!