I have a small problem with JTextArea, and I believe I know what causes it, but not sure how to correct it. When I call one in a frame it appears to just enough size to let the text I place in it show, but if now text then it appears very small. I think that has something to do with the FlowLayout, which I know is the defualt for the JFrame, and I know how to change it but to what, becuase I want to display multiple textarea/fields on one JFrame, like a form or something. Any help will be greatly appreciated Thank you Jesse
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
Moving this to the Swing / AWT / SWT / JFace forum...
Post your (compilable) code and explain what you think should happen
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
posted
0
FlowLayout will respect the preferred size of the JTextArea. Ways to specify the size include setting the number of rows and columns, setting its preferred size, or, for fluid resizing behavior, adding it to the center section of a container with BorderLayout or adding it to a container with GridBagLayout (with appropriately set constraints of course). The default layout manager for JFrame is BorderLayout. FlowLayout is the default for JPanel and JApplet.
Jesse Walker
Ranch Hand
Joined: Aug 18, 2004
Posts: 50
posted
0
My code is just new JTextArea(), nothing in the paraenthesis at all, what does the code in the paraenthesis do? Thanks Jesse
Warren Dew
blacksmith
Ranch Hand
Joined: Mar 04, 2004
Posts: 1328
posted
0
The arguments in the parentheses set the size of the JTextArea.