Expand JTextArea size

From: Nigel Underwood (email_at_nigelunderwood.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 15:47:44 -0000

Hi all,

I'd like to be able to automatically resize a JTextArea component depending
on the text and Font that has been entered by a user. Rather than place the
component on a JScrollPane and use a scroll bar to view the text entered,
I'd like to be able to progamatically increase or decrease the height of the
JTextArea as required.

I would like to do this programmatically as there are some other related
things that I would like to happen should the JTextArea be increased or
decreased in height. I've had a look a possibly extending JScrollPane and
JScrollBar to trap the drawing of a scroll bar, and then hence increase the
JTextArea height, but I am sure there must be another way to do this easily.

Any suggestions would be greatefully received.

Regards

Nigel.



Relevant Pages

  • Re: Expand JTextArea size
    ... > I'd like to be able to automatically resize a JTextArea component depending ... > component on a JScrollPane and use a scroll bar to view the text entered, ...
    (comp.lang.java.gui)
  • JScrollPane vertical bar is defaulting to the bottom
    ... I have a JScrollPane for a large panel, ... focus and caret position in the first JTextArea, ... scroll bar is at the top as expected. ...
    (comp.lang.java.gui)
  • Re: Wie erweitere ich die JTextArea so, dass sie automatisch die Scrollbalken anzeigt?
    ... > Eine Möglichkeit wäre zwar von JScrollPane abzuleiten und dann die ... > JTextArea der Klasse weitergeleitet werden aber das finde ich nicht so ... Prev by Date: ... Next by Date: ...
    (de.comp.lang.java)
  • Re: JScrollPane content sizing
    ... What I want to do is have a JScrollPane containing a JPanel. ... experiment, create a JTextArea using new JTextArea, and add it to a ... scroll pane because it is 1 by 1 pixel in size. ... members to the card layout and only show the object you want to show. ...
    (comp.lang.java.gui)
  • Re: Scrollbar in JScrollPane with JText Area Only Gets Bigger
    ... JScrollPane to incorrectly handle the scrolling of the JTextArea. ... > JScrollPane correctly adds or adjusts the vertical scroll bar to allow ... > underlying document, avoiding the need to set the rows in the ...
    (comp.lang.java.gui)