JScrollPane jsp=new JScrollPane();
jsp.setViewportView(new JTextArea());

解决方案 »

  1.   

    JScrollPane panel=new JScrollPane();
    panel.add(new JTextArea());
      

  2.   

    jScrollPane1.getViewport().add(jTextArea1, null);
      

  3.   

    JTextArea txt=new JTextArea ();
    JScrollBar js=new JScrollBar (txt);this.getContentPane().add(js);
      

  4.   

    JTextPane text=new JTextPane();
    getContentPane().add(new JScrollPane(text))
    这应该是你所希望的吧!
      

  5.   

    JTextArea txt=new JTextArea ();
    JScrollBar jsb=new JScrollBar (txt);this.getContentPane().add(jsb);