[问答题] 本题使用下拉菜单来控制字体,窗口中有一个标签和一个下拉菜单,当选中下拉菜单中的任一项字体时,标签上字符串的字体就随之改变。 import java.awt.*; import java.awt.event.*; import javax.swing.*; class ComboBoxFrame extends JFrame { public ComboBoxFrame(){ setTitle("java2"); setSize(300,200); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); style=new JComboBox(): style.setEditable(true); style.addhem("Serif"); style.addItem("SansSerif"); style.addhem("Monospaced"); style.addhem("Dialog"); style.addhem("Dialoglnput"); style.addActionListener(this); JPanel p=new JPanel(); P.add(style); getContentPane().add(p,"South"); panel=new ComboBoxTestPanel(); getContentPane().add(panel,"Center"); } public void actionPerformed(ActionEvent evt){ JComboBox source=(JComboBox) ; String item=(String)source.getSelect