Results 1 to 8 of 8
  1. #1
    JavaBender is offline Member
    Join Date
    Aug 2010
    Posts
    1
    Rep Power
    0

    Default Help Create Dynamic Srcollbar

    Example I create 1 TextArea with width = 400, height = 40. When enter Text into TextArea if width of text or height of text greater than width or height of TextArea then appear Scrollbar. Please help me.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by JavaBender View Post
    Example I create 1 TextArea with width = 400, height = 40. When enter Text into TextArea if width of text or height of text greater than width or height of TextArea then appear Scrollbar. Please help me.
    Read the API documentation for the constructors of a TextArea; there is one that allows you to specify the absence of scrollbars.

    kind regards,

    Jos

  3. #3
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default

    Jos, is there any method for JTextArea that setting word wrap to true?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by cselic View Post
    Jos, is there any method for JTextArea that setting word wrap to true?
    So you switched from a TextArea to a JTextArea? The API documentation for that class tells you all (short answer: yes it's possible to set/clear word wrapping).

    kind regards,

    Jos

  5. #5
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default

    So you switched from a TextArea to a JTextArea?
    I think that TextArea is obsolete in java.

    Example I create 1 TextArea with width = 400, height = 40. When enter Text into TextArea if width of text or height of text greater than width or height of TextArea then appear Scrollbar. Please help me.
    I think that word wrapping will be useful in this case.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by cselic View Post
    I think that TextArea is obsolete in java.
    No it isn't, it is just an old AWT object while the JTextArea component is a Swing object.

    kind regards,

    Jos

  7. #7
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default

    I have done word wrapping with: setLineWrap(true); and without setting horizontal scroll bar in JScrollPane.

    Jos, you were right:
    In API documentation they are saying that it is possible to set word wrap in JTextArea without using JScrollPane (and horizontal scroll bar settings).

    JavaBender, I think this will be useful for your problem.

  8. #8
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default

    No it isn't, it is just an old AWT object while the JTextArea component is a Swing object.
    I know that. Well maybe obsolete is not the real word but I think that awt for components are not in big usage in the year 2010. When advanced programers use awt for components they now really good what they are doing, but when beginners use it then I think that they have wrong book, looking wrong web pages on the internet or have a wrong teacher.

Similar Threads

  1. Problem--How to create dynamic tree structure in jsp using javascript
    By natu in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-11-2010, 08:11 AM
  2. How to create dynamic string object???
    By Stephen Douglas in forum New To Java
    Replies: 8
    Last Post: 04-12-2010, 02:35 AM
  3. Dynamic for loop
    By vikrambatra1709 in forum Advanced Java
    Replies: 3
    Last Post: 02-08-2010, 08:11 AM
  4. Dynamic GUI
    By ike2u in forum New To Java
    Replies: 4
    Last Post: 08-08-2009, 02:50 AM
  5. How to create Dynamic application using J2ME?
    By sharmaj2me in forum CLDC and MIDP
    Replies: 1
    Last Post: 01-31-2009, 03:19 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
  •