请选择正确的语句填入下列程序的横线处。 import javax. Swing.*; import java.awt.*; import java.awt.event.*; public class ex46

admin2008-01-11  36

问题 请选择正确的语句填入下列程序的横线处。      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

解析
转载请注明原文地址:https://kaotiyun.com/show/ronp777K
0

随机试题
最新回复(0)