سؤال

This is my code:

   JTextArea textArea = new JTextArea(15, 20);
   JScrollPane s = new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

And I'm adding the text area:

  add(textArea);
هل كانت مفيدة؟

المحلول

Add the JScrollPane and not the JTextArea to your container:

add(s);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top