I'm new to Java and while trying to add a text area to the applet, found the textarea uneditable, and while trying to add the scrollbar to the textarea, found the applet will not be started. Code as below:
import java.awt.*;
import javax.swing.*;
import java.applet.Applet;
public class AppletEditor extends Applet{
private JTextArea editor;
private JScrollPane pane;
public void init(){
resize(500,200);
setLayout(new BorderLayout());
editor = new JTextArea(300,200);
pane = new JScrollPane(editor, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
//pane = new JScrollPane(editor);
editor.setEditable(true);
editor.setBackground(Color.cyan);
Panel p1 = new Panel();
p1.add(pane);
add("North", p1);
}
}