Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

resize JTextArea

  Asked By: Pedro    Date: Apr 23    Category: Java    Views: 2030

I try but could not figuer out. I want to resize textarea to resize
with main window. I am getting main window size using Dimension d =

now, when ever i resize my window, i also want to resize the
jtextarea. Does anyone know how to do that.



1 Answer Found

Answer #1    Answered By: Chad Bradley     Answered On: Apr 23

U need to use any layout , for example BorderLayout and add your
textArea into contentPane or any Panel with your Layout.

Example :

Panel panel = (JPanel) frame.getContentPane();
You get a panel by other way.
And create a BodrerLayout (See the Doc of that class to know it
attributes CENTER, East , West, North, South)

TextArea textArea= new TextArea();
panel.setLayout(new BorderLayout());
Pane.add(textArea, BorderLayout.CENTER);

Didn't find what you were looking for? Find more on resize JTextArea Or get search suggestion and latest updates.