[填空题] 本题的功能是在文本域面板中添加一个带有行数的面板。窗口中有一个文本域,在文本域的左侧有一个带有数字的面板,该面板上的数字指示着文本域中的行数。
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
public class java3 extends Jframe
public static JTextPane textPane;
public static JScrollPane scrollPane;
JPanel panel;
public java3()
super("java3()");
panel=new JPanel();
panel.setLayout(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
textPane=new JTextPane();
textPane.setFont(new Font("monospaced",Font.PLAIN,12));
scrollPane=new JScrollPane(textPane);
panel.add(scrollPane);
scrollPane.setPreferredsize(new Dimension(300,250));
setContentPane(panel);
setCloseOperation(Jframe.EXIT_ON_CLOSE);
LineNumber
参考答案:
第A处:scrollpane.setPreferredSize(new Dimension(C00,BE0)) 第B处:setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE) 第C处:LineNumber LineNumber=new LineNumber(textPane)问题解析:
第1处Java是大小写敏感的;第2处设置窗口关闭方式应使用setDefaultCloseOperation()方法;第3处从下面的public LineNumber(JComponent component)可以看出LineNumber()需要JComponent型参数。

![[填空题] 本题的功能是在文本域面板中添加一个带有行数的面板。窗口中有一个文本域,在文本域的左侧有一个带有数字的面板,该面板上的数字指示着文本域中的行数。 import javax.swing.*; [填空题] 本题的功能是在文本域面板中添加一个带有行数的面板。窗口中有一个文本域,在文本域的左侧有一个带有数字的面板,该面板上的数字指示着文本域中的行数。 import javax.swing.*;](http://www.mshxw.com/aiimages/31/259964.png)
