[單項(xiàng)選擇題] 請選擇正確的語句填入下列程序的橫線處。 import javax. Swing.*; import java.awt.*; impo
[單項(xiàng)選擇題] 請選擇正確的語句填入下列程序的橫線處。 import javax. Swing.*; import java.awt.*; import java.awt.event.*; public class ex46 { static String str= "單擊次數(shù):"; 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
詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。