Results 1 to 3 of 3
  1. #1

    Member Since
    Nov 20, 2005
    Moorhead, MN
    Limiting the width of a JTextArea
    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.

  2. #2

    Member Since
    Dec 24, 2006
    N. Ireland
    Mac Pro 2xQuad core 2.8GHZ
    Are you trying to make it word wrap?

  3. #3

    Member Since
    Mar 27, 2007
    MacBook 2Ghz Core2Duo
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Safari tab width
    By bobtomay in forum macOS - Apps and Games
    Replies: 5
    Last Post: 09-03-2012, 02:47 PM
  2. help on limiting users
    By vjjuanka in forum macOS - Operating System
    Replies: 6
    Last Post: 12-31-2007, 02:34 PM
  3. page width
    By mikeyman in forum Web Design and Hosting
    Replies: 16
    Last Post: 04-18-2007, 06:50 PM
  4. screen width in parallels
    By xinelo in forum Running Windows (or anything else) on your Mac
    Replies: 4
    Last Post: 01-31-2007, 01:58 AM
  5. protecting b/width with Airport??
    By Chris Hooson in forum Internet, Networking, and Wireless
    Replies: 2
    Last Post: 04-20-2006, 05:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts