New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Limiting the width of a JTextArea

Post Reply New Thread Subscribe

Thread Tools

Member Since: Nov 20, 2005
Location: Moorhead, MN
Posts: 130
osvoldk is on a distinguished road

osvoldk is offline
It has been a while since I have posted on Mac forums, and I hope that everyone is doing well. Recently, I started working with Java, and I came across an interesting, and probably easy to fix, problem. I am implemented a class River, and I have implemented JScrollPane, JTextArea, JMenuBar and the like. In the JTextArea, I have made it editable, but now I have difficulties in limiting the width. I want it to be akin to Appleworks, where you have the margins and the text will automatically go down to the next line. I did enable the scrollPane, and perhaps that is where the problem is, doubtful though.
I tried a few different things from other online sources, to no avail, so I am hoping that the combined knowledge at mac forums can help me with this problem.

I will not run five kilometers with water.
Yo no correré cinco kilómetros con el agua.
Ich will nicht mit das Wasser fünf kilometer laufen.
QUOTE Thanks

Member Since: Dec 24, 2006
Location: N. Ireland
Posts: 901
Del has a spectacular aura about
Mac Specs: Mac Pro 2xQuad core 2.8GHZ

Del is offline
Are you trying to make it word wrap?
QUOTE Thanks

Member Since: Mar 27, 2007
Posts: 3
jaysonturner is on a distinguished road
Mac Specs: MacBook 2Ghz Core2Duo

jaysonturner is offline
basically create a new instance of JTextArea, and make it say 20 columns wide and 5 rows high.

JTextArea area = new JTextArea(5, 20);
now tell it wrap...

or to wrap without breaking words use..

hope this helps
QUOTE Thanks

Post Reply New Thread Subscribe

« Programming on Mac | double-click C executable. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Limiting internet access flyin3d Switcher Hangout 2 01-14-2009 10:14 PM
screen width in parallels xinelo Running Windows (or anything else) on your Mac 4 01-31-2007 01:58 AM
Question: 13.3" Widescreen Height + Width? asiantiger Apple Notebooks 1 10-29-2006 10:38 PM
Can't adjust column (view) width Morgan19 OS X - Operating System 1 02-02-2006 05:17 PM
Change Default col width in "column view"? thinkbible Apple Desktops 0 10-21-2004 09:16 AM

All times are GMT -4. The time now is 02:01 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?