[单项选择题] 请选择正确的语句填入下列程序的横线处。 import javax. Swing.*; import java.awt.*; import java.awt.event.*; public class ex46 { static String str= "单击次数:"; static intcnt = 0; public static void main(String[] args) { try{ UIManager.setLookAndFeel(UIManager. getCrossPlatformLookAndFeelClassName()); } catch(Exception e) {}Jframe jf = new JFame("ex46");JButton jb = new JButton("Button");jb.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae) { cnt ++; j1.setText(str +cnt); } });j1. setLabelFor (jb);jPanel jp = new JPanel();jp.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25);jp.setLayout(new GridLayout(0, 1));jp.add(jb);jp.add (j1);jf.getContenPanel() .add(jp, "Center");jf.pack();jf.setVisible (true); } }
A.Labelj1 = new JLabel(str + "0");
B.final JLabel j1 = new JLabel(str + "0");
C.final JLabelj1 = JLabel(str + "0");
D.JLabelj1 = new JLabel(str + "0");
正确答案:B
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)