求助:怎样可以建立文本区域
import java.awt.*;import javax.swing.*;
import java.awt.event.*;
public class Jishiben
{
public static void main(String[] args)
{
Kuangjia frame=new Kuangjia();
//MyText frame=new MyText();
frame.setTitle("记事本");
frame.setSize(800,600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class Kuangjia extends JFrame
{
public Kuangjia()
{
setLayout(new FlowLayout(FlowLayout.LEFT,1,1));
add(new JButton("文件"));
add(new JButton("编辑"));
add(new JButton("工具"));
add(new JButton("帮助"));
}
}
/* class MyText extends Kuangjia
{
private JTextArea textarea;
private final static String newline="\n";
{
public MyText()
{
setLayout(new BorderLayput());
textArea=new JTextArea(6,30);
textArea.setEditable(true);
}
}
} */
注释的部分还有错误,那位大虾可以帮忙改一下,小弟不胜感激
还有事件发生器应该怎样实现?