• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextArea and GridBagLayout ??  RSS feed

 
Haiko van der Schaaf
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having some trouble with JTextArea. I insert Strings by using the append() method,

for (int i = 0 ; i < ing.length - 1; i++ ) {
gekozenIngredienten.append((String )(ing[ i ] + ", "));

and that causes the JTextArea to grow in width. But when I am setting Linewrap to true my GridbagLayout turns in some really ugly screen. Does anyone know how to add Strings to a JTextArea without the Area to grow in width ?? Or setting LineWrap to true without my GridBagLayout going of the screen ?

Thanx Haiko
 
Michael Dunn
Ranch Hand
Posts: 4632
 
Haiko van der Schaaf
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael, is it illegal to post on two different forums ?? And if not, isn 't there a ex-Stasi meeting you should attend ?
 
Henry Addo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I will advice you to check the GridBagConstraints you set
that is the cause of the problem.Because i don't think adding
String to text or setting lineWrap to true will cause any problem
check the constraints you set.
 
Haiko van der Schaaf
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx, that fixed the problem. I have added weightX constraints and that did the trick.

Gr. Haiko
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!