Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2005

Tip: Looking for answers? Try searching our database.

Beginers Q: JTextArea

Thread view: 
pat - 30 Jul 2005 08:30 GMT
hi,

as an exercise, i am writing a simple text editor.

i have attached a JTextArea component to a JPanel component, and then
added this to a JFrame.

my problem is, when i resize the JFrame (by clicking on Maximise
button) the JTextArea component does not resize.

any help is greatly appreciated.
Andrew Thompson - 30 Jul 2005 09:09 GMT
Sub: Beginers Q: ...

Beginners 'Q's are best dealt with on a different group..
<http://www.physci.org/codes/javafaq.jsp#cljh>

> i have attached a JTextArea component to a JPanel component, and then
> added this to a JFrame.
>
> my problem is, when i resize the JFrame (by clicking on Maximise
> button) the JTextArea component does not resize.

This one is way easy.  Change the semi-colon after the second
closing brace of line 243 from a ':' to a ';'. That should
fix the problem right up.

No?

Then maybe you should tell us your (SHORT) code that fails..
(please read this document in its entirety for tips on that code)
<http://www.physci.org/codes/sscce.jsp>

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Now Interactive!  Joystick Controls Fry's Left Ear.

Michael Rauscher - 30 Jul 2005 09:12 GMT
pat schrieb:

> hi,
>
[quoted text clipped - 5 lines]
> my problem is, when i resize the JFrame (by clicking on Maximise
> button) the JTextArea component does not resize.

JPanel uses FlowLayout by default. But FlowLayout doesn't fit to your
needs. Use BorderLayout instead and add the JTextArea to the center:

JPanel panel = new JPanel(new BorderLayout());
panel.add( textArea );

Or to be more specific:
panel.add( textArea, BorderLayout.CENTER );

Bye
Michael


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.