How to wrap the text in a jTextArea

Hello all,
I am currently developing a simple simulation program for our scientific research group. My boss asked me to employ the program with a GUI. However, I am new to Java Swing. It is nice to have you guys that may provide a helping hand to my problem.
My problem is with the jTextArea. Because my result to be displayed in jTextArea is lengthy and its length varies. The way I extract the result is to use a String to hold all of the results and directly pass it to the jTextArea. However, It is lope-sided and not quite user-friendly. Is there any function that I can use so that the text can be wrapped and that the user doesn't need to scroll left or right to view the results?
Thanks in advance(:
Message was edited by:
Shahn
Message was edited by:
Shahn

am currently developing a simple simulation program for our scientific
research group. My boss asked me to employ the program with a GUI.
However, I am new to Java Swing. It is nice to have you guys that may provide
a helping hand to my problem.something is amiss.
you're a developer (new to swing is irrelevant) and you don't know how to read the api docs?
there are only 6 set...() methods (apart from inherited) and what you want is 2 of them.

Similar Messages

  • How to wrap the text in column headers?

    Hi Friends,
    Can anyone please suggest how to wrap the text in column headers of a Java WebDynpro table?
    I believe that caption is the only UI element that a column header can have and it does not allow wrapping of the text.
    My original requirement is as follows,
    In a table I need to dynamically set the width of the columns according to the width configured by the user in some other view. All the columns of the table are dynamically rendered.
    Now what happens is when the user sets the width of the column to a rather low value, say 15 pixels, then the column is displayed like
    Supplier Catalog Name
    Sheila
    Catalog
    Name
    Dropdown
    As you can see it looks rather odd.
    Supplier Catalog Name is the header of the column and I use IWDCaption for header.
    Sheila Catalog Name Dropdown is the value of a particular row at the specified column. I am using a TextView as the TableCellEditor.
    I think what is happening here is that the framework wraps the text in the TextView according to the width specified (15px) and then the column width is extended because it can not accommodate the text (Supplier Catalog Name ) of the column header.
    We are using SAP NetWeaver Development Studio 7.0.12 as the IDE.
    I searched some forums and many people have suggested using scrollable columns but I don't understand how it will help in wrapping the text in a column header.
    Any help would be of great advantage.
    Thanks
    Amit

    Hi Deepti,
    Thanks a lot for the answer but the option that you have specified does not wrap the text. Instead it truncates the text being displayed and only the substring of the text which could be displayed in the given pixels is displayed.
    I need to show the whole text wrapped (Meaning if the width of the column is not sufficient then the text goes into the next line).
    Ayyapparaj,
    Thanks to you too for an helpful answer. It seems that the Netweaver has finally come up with a way to wrap the text in the column headers but as Manoj pointed out, I do not see the property headerTextWrapping  for a table column, Can you please specify which version of netweaver supports it?
    We are using SAP NetWeaver Development Studio 7.0.12 as the IDE.
    Thanks
    Amit Kapoor

  • How to wrap the text in JTextPane

    hi all,
    I have a problem with JTextPane. I have a JPanel which have 4 JButtons, one Details button and one JTextPane. I have set JTextPane to JScrollPane. Thing is when i press the Details button the JTextPane must be visible. Window size is changing. can any one say how to wrap the text in the JTextPane.

    By default text in a JTextPane will wrap, so I don't understand the question.
    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/text.html]Using Text Components for a working example.

  • How to get the text present in JTextArea

    i am writing application for some system to be computerised and i am not getting how to get the text present in text area and set it into database...can anybody suggest me solution??

    You must have named the TextArea like
    JTextArea textArea;so, use the getText() method like
    String strTextAreaContents = textArea.getText();You can then use JDBC to connect to the database that you want and save your contents that is now in strTextAreaContents.
    -- Srikanth

  • How to wrap the text in a label component

    I'm displaying a text in the label component and the output is displayed on the plasma display(It is a java application running on a pc and output is given to plasma display). But the text size is more and getting cut at the edge on the display. How can I wrap the text automatically.

    See
    [http://forums.sun.com/thread.jspa?messageID=10391430]

  • How to store the text Inputted in JTextArea

    I have created a JtextArea using Applets. I wanted to know how we get the text from that area and store it in a datastructure?..please help me

    String text = textarea.getText();

  • ADF 11g + How to wrap the text in a goimagelink

    Hi All,
    I'm displaying some list of goimagelinks, for which the information is being retrieved from the database. Now to align the width in between the imagelinks properly, I need to wrap the text of the go image link. Any suggestions, will help me a lot.
    Thanks All in Advance. Below is the code snippet for the same.
    Thanks & Regards,
    Dharmathej M
    <af:panelFormLayout id="pfl6" rows="3" maxColumns="3"
    labelWidth="30"
    inlineStyle="text-align:justify;">
    <af:iterator id="i6"
    value="#{bindings.LP_Applications1.collectionModel}"
    var="appiter"
    rows="#{bindings.LP_Applications1.rangeSize}">
    <af:goImageLink text="#{appiter.bindings.AppName.inputValue}"
    id="gil2"
    icon="#{appiter.bindings.Icon.inputValue}"
    iconPosition="leading"
    inlineStyle="font-size:small; font-family:Verdana, Arial, Helvetica, sans-serif;"
    destination="#{appiter.bindings.Url.inputValue}"
    shortDesc="#{appiter.bindings.ShortDesc.inputValue}"
    targetFrame="#{appiter.bindings.ExtLink.inputValue == 'T' ? '_blank' : '_self' }"/>
    <af:spacer width="70" height="10"/>
    </af:iterator>
    </af:panelFormLayout>
    ################################################################

    Try the CSS <tt>display</tt> property in combination with some fixed width, for example:
    <af:goImageLink ... inlineStyle="display:inline-block; width:80px;">

  • How to wrap the text in a popup LOV item ( Apex 4.0 )

    Hi
    I have a popup LOV type item with a very long string value
    I would like to format the item so itr will be shorter but have the string wrap to multiple lines.
    Can you let me know how that can be achieved ?
    thanks
    O

    Hmm.. I don't know about that.
    I actually already managed to change the width of a specific popup element by putting the following in the region footer :
    <script type="text/javascript">
    $x('P3_CONTRACT').style.height="20px";
    </script>
    that works fine and only impacts that specific element.
    However , Since I know next to nothing of HTML and Javascript , I could not figure out the code to put to make the text wrap.
    your solution suggests that it will take care of the width , but will it cause the words to wrap ?
    thanks
    O
    Edited by: Orna Weisman on Apr 30, 2012 7:08 AM
    Edited by: Orna Weisman on Apr 30, 2012 7:15 AM

  • Wrapping the text on the confirmation dialog

    Can any one pls tell me how to wrap the text on a confirmation dialog?
    thanks in advance.
    regards
    Lakshminarayanan.V

    Hi,
    Currently this is simply not possible. Probably later TextView UI element will be enhanced to support this (at least, this feature is at "Whish List", search this forum for word POLL), and confirmation dialogs will inherit desired behavior automatically.
    For now you have to create your own component and use it pop-over window as confirmation dialog. In your component you may either use TextArea for multi-line display (quick and ugly) or split string into several context attributes and display them using several TextView UI elements (either dynamically created or pre-created till some reasonable maximum, say, 5 lines <-> 5 controls)
    VS

  • How to wrap the heading text in alv.

    HI all,
          I need help, how to wrap the heading text in alv.
    can any help ... plz..
    Advanced Thanks
    Regards
    GUhapriyan

    Hello GuhaPriyan,
    I assume that you're referring to the ALV Grid's title. The maximum length for this title is 70 characters and this would generally fit in the one line.
    Are you intending to wrap it because you purposefully want the text to come in two lines? In that case, I'm not sure that it's possible.
    But otherwise, there's an option in the Layout called SMALLTITLE. You can set this attribute so that the title would be displayed in a amaller font and hopefully, all of your text shows up on the screen.
    Regards,
    Anand Mandalika.

  • How can I wrap the text for LinkToAction UI Element.

    Hi All,
    I am trying to wrap the text for LinkToAction UI Element which is inside the group.I have set the wrap property to be true.But still its not getting wrapped.I have set the width of the group to be 0px.I have even set the wrap property for the RootUIElementContainer and set the width property to be 0 px.I am using the FlowLayout.Any ideas are appreciated.
    Thanks in Advance

    I have the same problem.
    would you plz tell me how to wrap.

  • How to get the content of a jTextArea?

    hi everyone
    can some body provide me with some help???
    I want to know how to get the content of a jTextArea
    it may be a String and i want to use that String to make some applications
    I've use this :
    String ch=jTextArea.getSelectedText()
    but i'm not sure it will work and i'm not sure it will take the text writen inside the jTextArea ... please help
    Thanks

    http://forum.java.sun.com/thread.jspa?threadID=778988&tstart=0

  • How to print the text in points wise in sap script

    hi friends,
    how to print the text in points wise in sap script.
    ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
    1. hai how ru.
    2. what r  u doing.
    3.where r u.
    like this i want numbering.. waiting for ur replys.
    thanks,
    kiran

    declare a counter
    data : cnt type char 4.
    print :
    cnt = cnt + 1.
    &cnt& &text&
    cnt = cnt + 1. and so on.
    or.
    if the data is in an internal table
    loop at internal_table.
    cnt = cnt + 1.
    write form.
    in script -&cnt& &text&
    endloop.
    Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM

  • How to print the text in only last but one page in sapscripts

    hiiiiiiiiiii,
             explian how to print the text in only last but one page in sapscripts? wher to write the code? plz if possible explain in detail with an example?

    Hello,
    The total no pages is given by &SAPSCRIPT-FORMPAGES& command.
    So u can handle the situation in ur form like this
    /: if &PAGE&  = &SAPSCRIPT-FORMPAGES&
    p1 TEXT
    /: endif
    Try in this way it may help u.
    Regards

  • Did you know how to link the text in two or more text boxes?

    Did anyone know how to link the text in two or more text boxes in Pages 5.0? Thanks for your answer.
    Qualcuno sa come collegare il testo in due o più caselle di testo nella versione 5.0 di Pages. Grazie per le vostre risposte.

    It's just one of the many, many features that have been eliminated or changed. Leave feedback for the Pages team using the link in the Pages menu and review & rate the new versions in the Mac App Store.
    If you previously had iWork '09, those apps are still in your Applications folder in a folder named iWork '09. You can continue to use them to get things done.

Maybe you are looking for