Salve gente,
siccome sono stufo di fare tutte le volte la textarea e poi aggiungerci lo scroll, volveo fare una classe ad hoc.
codice:
import java.awt.Rectangle;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class jTextAreaScroll extends JTextArea {
public JScrollPane jsp=null;
public jTextAreaScroll(int x, int y, int w, int h) {
super();
this.setBounds(new Rectangle(x,y,w,h));
this.setWrapStyleWord(true);
jsp = new JScrollPane(this);
jsp.setBounds(this.getX(),this.getY(),this.getWidth(),this.getHeight());
}
}
codice:
jtp = new jTextAreaScroll(10,25,300,300);
jPanel.add(jtp, null);
ma la text area viene creata, mentre la scroll nulla di nulla...
dove sta l'errore?