写错了是JScrollPane,JScrollPne是容器类

解决方案 »

  1.   

    放到了JScrollPane中后,什么都看不见了
    public class testapplet extends JApplet{

    public static JTextArea out;
    public void init(){
    Container contpan=getContentPane();
    JScrollPane myp=new JScrollPane();
    contpan.add(myp);
    out=new JTextArea("Output Area!\n");
    myp.add(out);
    }
    }
      

  2.   

    你加的方法有点问题:)
    myp.getViewPort().add(out,null);
    contpan.add(myp);
      

  3.   

    谢谢,你的方法的确可以出现TextArea了,但是却还不象我想象的那样,可以固定大小。(我主要是想让TextArea大小固定)
      

  4.   

    你是怎么设置的大小?jpanel的layout是什么?代码呢?
      

  5.   

    代码在上面,无Layout,未设置PANEL的大小