2. 设计一个简单的实现字体设置窗口程序,可根据用户选择设置字体的种类、字号、字形、颜色等属性。运行结果:
import javax.swing.*;import java.awt.event.*;import java.awt.*;
public class FontSet extends JFrame implements ItemListener, ActionListener{
JRadioButton jrbRed = new JRadioButton("红色",true);
JRadioButton jrbGreen = new JRadioButton("绿色");
JRadioButton jrbBlue = new JRadioButton("蓝色");
private ButtonGroup bg = new ButtonGroup();
JCheckBox jcb1 = new JCheckBox("加粗");
JCheckBox jcb2 = new JCheckBox("倾斜");
JComboBox listFont;
JList listSize;
JTextArea taDemo;
JButton btnExit,btnEdit;
public FontSet(){
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
String fontNa