Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

resize JTextArea

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

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 =
Toolkit.getDefaultToolkit().getScreenSize();

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

Share: 

 

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();
Or
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.




Tagged: