File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTextAreas with a GridLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextAreas with a GridLayout" Watch "JTextAreas with a GridLayout" New topic
Author

JTextAreas with a GridLayout

Jacob Coddaire
Ranch Hand

Joined: Jan 11, 2011
Posts: 36

Hey guys. Here's my code. It comes in two classes:





What I would like to do is make the output text area about twice the size of the errors text area. The majority of the program will be displayed in the output area, so I would like to have that take up a decent portion of the screen.

Also, for the customers JTextArea portion. I currently have them colored light grey. Is there any way to mimic the gray behind the JLabels that are right next to it? I want to have it look like a seamless integration from component to component.

Your help is much appreciated!
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
What I would like to do is make the output text area about twice the size of the errors text area.


Then you can't use a GridLayout since all compnents are set to the same size. You can either use a SpringLayout (the Swing tutorial has a working example for creating a simple form like this) or a GridBagLayout, which is more complicated.

But first you need to create your text area with different preferred sizes. You can do this by using:

Jacob Coddaire
Ranch Hand

Joined: Jan 11, 2011
Posts: 36

Thanks for the help. I've also figured out the color thing. Case closed.

For reference, I used the following code on the color.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTextAreas with a GridLayout