File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Need help with JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help with JTextArea" Watch "Need help with JTextArea" New topic

Need help with JTextArea

Lola Mylen

Joined: Apr 22, 2005
Posts: 1
I am using the code below to set text in text area within one dialog. What happens is that when I run on my machine it all looks fine, but person on a different machine can see text in area 3 tames narower and 3 times higher than what I declared it to be, which in turns makes other objects in dialog pushed down. I can't see anything wrong with code. So I decleared 3 rows and 38 coluns, but on one of machines text area looks like it has 10 rows and 5 columns. Any ideas? I have JRE 1.4.2 while other person has 1.4.1. Any help appreciated. Thanks.

JTextArea xcNews = new JTextArea("some text", 3,38);
c.gridx = 2;
c.gridy = 6;
c.gridwidth = 6;
c.gridheight = 1;

xcNews .setLineWrap(true);
xcNews .setWrapStyleWord(true);
xcNews .setEditable( false );
xcNews .setRequestFocusEnabled( false );
xcNews .setBackground( xcPanel.getBackground() );
gridbag.setConstraints(xcNews ,c);
xcPanel.add(xcNews );
I agree. Here's the link:
subject: Need help with JTextArea