Swing: How to insert a new line in JTextArea?

As the title says, how do i position a text to the next line? The conventional "\n" doesn't seem to work in JTextArea....how can i resolve this?
Thank You. :-)

Is it running under windows?
If so, try "\r\n"
If that fixes the problem, use System.getProperty("line.separator") which returns the appropriate string ("\n", "\r" or "\r\n") for the system it's running on.

Similar Messages

  • How to insert a new line in MC1H(maintaining formula)

    How to insert a new line in MC1H(maintaining formula)
    Can anybody help me with  the steps

    Hi,
    1.run transaction SCC4 -> press Ctrl+F4 or the button for change ->double click one the row for your client -> on the field Cross Client Object Changes select Changes to the Repository and cross-client Customizing allowed -> SAVE
    2. run MC1H and now you will have access to insert new line in the table
    Regards Vassko!
    Edited by: Vasil Pavlov on Sep 16, 2008 9:51 AM

  • How to Insert a new line in a clob

    hi,
    i want to create reports as multi-line clob data using PL/SQL procedures.
    is there any standard way of inserting a new line when iam generating
    this clob data based on the data i fetch from a different table.
    i short my question is "How to insert a new line in a clob?"
    i tried using the character '\n', but that was of no use.
    thanks in advance
    ramesh

    You could always do a:
    newLine := '
    Since PL/SQL allows a tring to span multiple lines.

  • How to insert a new line item in VA01/VA02 by using ABAP code?

    Hi Gurus
    i have a very tough requirement. the customer wants to insert a free goods after an item has been populated in VA01/VA02 automatically according to some certain rules. the input material may be a main material of a sales BOM.
    for example. let's suppose there is a material A who has two sub-material B and C which is maintained in a sales BOM via CS01/CS02. when the material A has been input in the line item in VA01/VA02, its quantity input and after the ENTER key has been clicked, another material D may be displayed in a new line as a gift if the condition met.  the condition relates to customer/material/quanity and these information are stored in a Z-table.
    on the other hand, if the material A is only a single material(not a BOM), the gift(material D) will also be filled automatically if the condition met.
    i have already enhance the FM cs_bom_explosion to filfill the requirment for BOM materials. whereas it is very hard to find the enhanment point for the single material.
    so my question is where is the correct place for me to insert the ABAP code, which decides whether the gift should be given or not and furthermore inserts the new line item into XVBAP. i tried to use MV45AFZZ, whereas the data is always inconsistant if a new line has been inserted. it is very strange that there is no temperary internal table storing line item data input in the table controal of VA01/VA02. system reads the line item data , line by line, via a system kernal function call.
    any hints are welcome. thanks

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • How to insert a new line character inside CDATA tag in the source xml data file?

    values for form fields in the xml data file is contained inside CDATA tags which is an Unparsed Format.
    Eg: [CDATA[IBM-01 ~ DSHFSJDSJ ~ FGFGFJ, ~ VA 665665]] delimited by "~" char
    Actual o/p:-
    IBM-01 ~ DSHFSJDSJ ~ FGFGFJ, ~ VA 665665
    Expected o/p is like :-
    IBM-01
    DSHFSJDSJ
    FGFGFJ,
    VA 665665
    live cycle product does not interpret ~ as a newline character. Please suggest which character should be used instead inside CDATA section or if there is any other way to fix this?

    I do not have any problem while using IE's XML parser
    for XML+XSLT merging.That is because IE's parser does not implement XML correctly.
    But when I use JAXP's Transformer object, it does not
    preserve the new lines inside attribute values and
    converts those into white spaces.That is exactly what the XML specifications say should happen.
    >
    ----If you have text that contains newlines, you
    should put it in an element, not in
    ----an attribute.
    That would be my last solution. But I'd really hate
    to change my logic just 'coz JAXP is not capable of
    handling new lines inside attribute values. I may be
    wrong... but If IE can keep those then there has to
    be a way to do the same from server side merging....Sure. Write your own parser with the same bug in it. But you don't have any right to demand that other people supply you with parsers that work incorrectly.

  • How to Insert the new line items in Billing

    Hi Friends,
    I have an issue in Billing process.
    When the user is creating the billing document from Delivery document, then based on some conditions, I have to split the line item into 2 different line items(We have to change the Quantity and value).
    Please let me know what are all the possible options.
    Regards
    Elini.P

    Many times, there is no new line (unless there is some sort of list in the paragraph). Since Word (actually most editors now) word wraps automatically, the paragraph is usually (essentially) one long line that the editor wraps for you.
    But, to tell you the truth, I don't see anywhere in that code where you are even attempting to find newline characters. What, exactly, are you trying to accomplish. I.e. what is your desired result (not the process you are envisioning to get there).

  • How to insert a new line in a jlabel???

    hi everyone
    i have a panel that have a jlabel... my problem is that i can make this label show line feeds even though im adding the "\n" escape character...
    please help
    thanks in advance
    this is my code
    <code>
    import java.awt.FlowLayout;
    import javax.swing.BoxLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Test extends JFrame{
    private String message = "This tool is used to set the database path\n" +
    "If the database is on the local machine, you should use \"localhost\" or \"127.0.0.1\"\n" +
    "If the database is on a networked machine, you should use the IP address of that machine\n";
    private JLabel help = new JLabel(message);
    private JPanel mPanel = new JPanel();
    private JPanel hPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    public Test() {
    setTitle("Database Path Updater");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setSize(450,350);
    setLocation(100,100);
    setResizable(false);
    setupComponents();
    initializeGUI();
    private void setupComponents() {
    mPanel.setLayout(new BoxLayout(mPanel, BoxLayout.Y_AXIS));
    private void initializeGUI() {
    add(mPanel);
    hPanel.add(help);
    mPanel.add(hPanel);
    public static void main(String[] args){
    new Test().setVisible(true);
    </code>

    bif_f wrote:
    thank you...that was really helpful but i just wanna know if using HTML tags is the only way to accomplish this task ????I think it's the only way because "\n" doesn't work and that's what I have learned a long
    time ago in this forum.
    another not related question: do you have any idea where the CODE tags are in this new forum???? i cant find them and i think you have noticed that i have inserted source code that are not CODE formatted....The forum has been updated you should notice that when you replied
    I don't know what's on there mind but they remove the code tags.
    you have to put it manually.
    e.g.
    [code]
    your code
    [[b]code]

  • How to insert a new line in table control created in screen painter

    hai,
    i am stuck up in the place where i need to insert a row of data in the table in screen developed in screen painter..cud some one help me out...

    You can try the following statement:
    MODIFY <DBtable> from table <itab>.
    Of course, you would need to append the user-entered data (from the screen) into the internal table first.
    Hope this helps.
    Sudha

  • How to add a new line in pe51?

    Hi Team,
    I want to add anew field in pe51 form editor.
    for that i want to add anew line in pe51 form
    i went to pe51 tcode and selected background raidobutton.
    but from ther i dont know how to add a line at the required position.
    So please reply me on this as soon as possible.
    Thanks & Regards,
    Kranti.

    Hi Kranti,
    The reason, why you are not able to insert a new line in background could be that the maximum line size defined in attributes is already utilized. Thats why F7 doesn't work.
    1- From main screen of PE51, select your pay slip, click on attributes and than click on change button.
    2- Increase value in lines field and save changes.
    3- Go to background and try to insert new line with F7 keyboard key.
    I hope this is what you are looking for.
    Regards,
    Waqas Rashid

  • REUSE_ALV_GRID_DISPLAY == How to add a new line?

    Hello SDN community,
    I'm using the "REUSE_ALV_GRID_DISPLAY" function with "i_save = 'X'". How can I solve the following problem: I want to insert a new line into the ALV and after a click on the SAVE Button, the internal table should have this new line too?
    Best regards,
    Marius Klaus
    [click for an example picture|http://pic-hoster.net/upload/0a8b8c5c7a38434f4e0010ceb7f6fbe7.jpg]
    Edited by: Marius Klaus on Nov 30, 2009 4:00 PM

    on the click of add button(for adding an line in grid_display)  write the following code.
    t_user_input is the table to be displayed in ALV_GRID.
    DATA : ob_ref_grid TYPE REF TO cl_gui_alv_grid.
      READ TABLE t_user_input INTO e_user_input INDEX  1 .
              MODIFY e_user_input(as per user's requirement)           
              APPEND e_user_input TO t_user_input.
          CALL METHOD ob_ref_grid->check_changed_data .
          CALL METHOD ob_ref_grid->refresh_table_display.
    Regards,
    Shekhar

  • How to insert a new row in the middle of an set of rows

    Hi
    How to insert a new  row in the middle of an set of rows ? and How to Reset the line id after the new row added ?
    Regards,
    Sudhir B.

    Hai,
    just try this,
    Instead of using omatrix.Addrow(1,-1) use like
    omatrix.AddRow( RowCount , Position)
    RowCount
    The number of rows to add (default is 1)
    Position
    The position of the new rows (0-based; default is -1, meaning append row to the end)
    After adding rows in matrix For, sno.
    for i=1 to omatrix.visualrowcount
    otext=omatrix.getcellspecific("columnid",i)  '--where columnid is the unique id of the sno column
    otext.value=i
    next i
    Hope this helps you.
    Thanks & Regards,
    Parvatha Solai.N

  • Want to know how to check for new line character in text file

    Hi All,
    I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
    Thanks
    static int readandwriteFile(Logger logger,String filepath){
              BufferedWriter out = null;
              BufferedReader in = null;
              File fr = null;
              int get_count = 0;
              try     {
              if(new File(filepath).exists())
              fr= new File(filepath);
                        System.out.println("FileName: "+fr);
                   if(fr != null){
    in = new BufferedReader(new FileReader(fr));
                             String text = in.readLine();
                             if(text != null){
                             get_count = Integer.parseInt(text);
                             in.close();
                             else{
                                  get_count = 0;
         else{                    
    out = new BufferedWriter(new FileWriter(filepath));
         out.write("0");
                out.close();
                   }          //Reading of the row count file ended.
              catch(Exception e) {
                   e.printStackTrace();
              finally {
                   try{               if (in != null) {
                             in.close();
              if (out != null) {
                             out.close();
              catch(Exception e) {
                        e.printStackTrace();
              return get_count;
         }

    You are calling the readline() only once which means you are reading only the first line from the file...
    Use a loop (Do-While preferably)
    do{
    //your code
    }while(text == "")

  • How to add a new line in SMS(Line Break).

    Hi All,
    I need to send SMS from PL\SQL Procedure
    The problem i have been facing is that the string being passed in as sms content is not parsing a newline character.
    It shows all content in one line.
    I need to break them in several lines.
    Give me a direction how to add a new line in SMS.
    Regards,
    Raj.

    Hi,
    Sure, Here it is
    CREATE OR REPLACE PROCEDURE APPS.AUTO_SMS_RTV_REPORT
    IS
    sender          VARCHAR2(1000);
    recipient     VARCHAR2(1000);
    message          VARCHAR2(4000);
    sub          VARCHAR2(1000)     := 'HELLO';
    dt1          varchar2(1000)     := to_char(sysdate,'DD-MON-YY');
    mailhost     VARCHAR2(30) := '10.7.7.xxx';     
    mail_conn     UTL_SMTP.CONNECTION;
    v_crlf VARCHAR2(2) := CHR(13)||CHR(10);
    CURSOR cur_Rejection_Records IS
                   SELECT DISTINCT
                        rt.VENDOR_SITE_ID               ,
                        pvs.email_address     VENDOR_MAIL_ID     ,
                        pvs.PHONE          vendor_contact_no ,
                        hre.EMAIL_ADDRESS     Employee_mail_id ,
                        hre.FULL_NAME
                   FROM apps.rcv_transactions      rt,
                        apps.po_vendors           pv,
                        apps.po_vendor_sites_all     pvs,
                        apps.mtl_transaction_reasons mtr,
                        apps.fnd_user          fu,
                        apps.hr_employees          hre     
                   WHERE transaction_type = 'RETURN TO VENDOR'
                   --AND        TRUNC(rt.transaction_date) = TRUNC(SYSDATE)
                   AND     rt.vendor_id          = pv.vendor_id
                   AND     rt.vendor_site_id     = pvs.vendor_site_id
                   AND     rt.REASON_ID          = mtr.REASON_ID(+)
                   AND fu.user_id          = rt.last_updated_by
                   AND hre.EMPLOYEE_ID     = fu.EMPLOYEE_ID
                   AND TRANSACTION_ID IN (
                                  11902189,
                                  11902253,
                                  11902148)
    BEGIN
         FOR rec_Rejection_Records IN cur_Rejection_Records
         LOOP
         Begin
              sender     := '<[email protected]>';
              recipient     := rec_Rejection_Records.vendor_contact_no || '@aaaa.com';
              mail_conn := utl_smtp.open_connection(mailhost, 8025);
              utl_smtp.helo(mail_conn, mailhost);
              utl_smtp.mail(mail_conn, sender);
              utl_smtp.rcpt(mail_conn, recipient);
              utl_smtp.DATA(     mail_conn,
                                  'Date: ' || TO_CHAR(SYSDATE, 'Dy, DD Mon YYYY hh24:mi:ss') || utl_tcp.crlf ||
                                  'From: ' || sender     || utl_tcp.crlf ||
                                  'Subject: '|| sub     || utl_tcp.crlf ||
                                  'To: ' || recipient || utl_tcp.crlf ||
                                  utl_tcp.crlf ||
                                  'Dear Supplier,'||CHR(10)|| utl_tcp.crlf ||'\\\0x0A'|| -- HERE I NEED LINE BREAK
                                  'Please.'|| utl_tcp.crlf                          
              DBMS_OUTPUT.PUT_LINE('Yep !!! SMS Sent Sucessfully :) ');
              utl_smtp.quit(mail_conn);
         EXCEPTION
              WHEN UTL_SMTP.PERMANENT_ERROR THEN
                        dbms_output.put_line('Error - ' || SQLCODE || ' - ' || SQLERRM);
              WHEN OTHERS THEN
                        dbms_output.put_line('Error - ' || SQLCODE || ' - ' || SQLERRM);
         END;
         END LOOP;
    END AUTO_SMS_RTV_REPORT;
    /

  • How to create a new line in label in Xcode

    How to create a new line in label. for example I have two buttons & one label. when i press first button, l want to change the label text to "Hello World". then when I press the second button, on the same label I need to display"Good Bye" on the next line in xcode 5?
    I want to display the lablel like below:
    Hello World
    Good Bye

    I am using Xcode to develop an app for iOS.
    I tried using multi-line label & belwo is my code.
    - (IBAction)change:(UIButton *)sender {
        self.Screen.text = @"\nHello World";
    - (IBAction)newChange:(UIButton *)sender {
          self.Screen.text = @"\nGood bye";
    everytime when i pressed the button, it replacing the whold lable text instead of adding the second line.

  • How to insert the new field to standard scheduling agreement script form.

    Hi Gurus,
    how to insert the new fields to standad sheduling agreement script form. its a need for me, i want to display the AEDAT field in scheduling agreement form ,
    The below one is my requirement,
    ex:-   Itu2019s requested the change of Scheduling Agreement printout. Itu2019s requested for this type of   document, the insertion, into the field u201CData Emissionu201D into the print, of the document last modify date instead of the document creation date. (This change will be done only for position change into the Scheduling Agreement). No change into the PO.
    Change SAPSCRIPT printout. Introduction, into the Scheduling Agreement, of last modified  
          document date (field EKPO-AEDAT).
    Thanks & Regards
    chinnu

    open TNAPR table and give the output type you need to modify.... get the print program name and check if some structure already have the date you wanted... if you have it already... then open the form in SE71 tr. and provide the strcuture name - feild in the position you want to have the date...
    se71--->
    &<str. name>-AEDAT&

Maybe you are looking for

  • PC Suite 6.86.9.3 does not start after reboot

    Hi! I have some strange problems with the PC Suite. After the first install everything is working well but after a reboot the PC suite is not starting after double click on the desktop icon. But i can install tools on the phone or start some of the s

  • Use of field selection Key.

    Hello I am implementing  the release strategy for the Purchase requisition. can anyone please tell me what is the significance of "Field selection key" and "Value change" under the release indicator. Regards

  • Tax procedure-MIRO-Tax code

    Dear friends, While creating the MIRO, iam getting the message as below. "Tax code F1 country IN does not exist in procedure TAXINN" Where to create tax code F1 in Tax calculation procedure and how to assign to TAXINN. For TAX IN also we need to crea

  • Cannot restore config backup on WRVS4400N

    my router crashed/reset to factory defaults last night. i tried to restore an old backup but it gave me following error: Restore failure (Unmatched pid) so for several hours i reconfigured it manually and all seemed good. just for the fun of it, i tr

  • SSL Certgen Weblogic 6.0. Help Needed!

    Hi, I am using Weblogic 6.0. I want to enable SSL. I understand that for that I need a certificate. Now I want to create my own. In the documentation for Weblogic 7.0 it is mentioned that I can create it using certgen. I cant find it. Is it not avail