当前位置:IT认证>软件水平

问题:[填空题]

[填空题] 本题的功能是在文本域面板中添加一个带有行数的面板。窗口中有一个文本域,在文本域的左侧有一个带有数字的面板,该面板上的数字指示着文本域中的行数。 import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class java3 extends JFrame public static JTextPane textPane; public static JScrollPane scroll

  

参考答案:

第A处:scrollpane.setPreferredSize(newDimension(C00,BE0))
第B处:setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
第C处:LineNumberLineNumber=newLineNumber(textPane)

  参考解析

第1处Java是大小写敏感的;第2处设置窗口关闭方式应使用setDefaultCloseOperation()方法;第3处从下面的publicLineNumber(JComponentcomponent)可以看出LineNumber()需要JComponent型参数。

微信端