Get new line

hi....
i have this program which is a simple instant messaging window....however....i can not edit to code so that the second message comes on the second line in the editorPane and so on....it prints each string on top of each other...
can someone please help me with this....i have tried putting in "\n" but this has no effect
what should i do???
Amit

hi....
i have this program which is a simple instant
messaging window....however....i can not edit to code
so that the second message comes on the second line in
the editorPane and so on....it prints each string on
top of each other...
can someone please help me with this....i have tried
putting in "\n" but this has no effect
what should i do???
Amitsorry...the code which i had originally is this....i have tried adding a <br> tag...but that still doesnt work
what should i do??
please help
Amit
* ChatDialog.java
* Created on 19 March 2004
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.text.*;
import java.net.*;
import java.util.*;
import java.applet.*;
import java.io.*;
import javax.swing.Timer;
import javax.swing.text.html.*;
/* Class for the instant messaging window that opens up when a user clicks on another user
public class ChatDialog extends JFrame implements ActionListener
     //variables declaration
     private ChatDialog thisframe;
     private Container container;
     private JEditorPane recv;
     private JTextArea type;
     private JButton send;
     private Calendar clock;
     private User user;
     private int hwnd;
     private Timer timer=null;
     boolean isFocused = false;
     private int w,h;
     public ChatDialog()
     {                                                             // start constructor
          thisframe = this;
          this.user = user;
          container= this.getContentPane();
          container.setLayout(null);
          recv = new JEditorPane(); // conversation box
          recv.setEditorKit(new HTMLEditorKit());
          recv.setFont(new Font("Arial",Font.PLAIN,12));
          recv.setEditable(false);
          recv.setToolTipText("<HTML><Font color = black face = Arial> <center> Messages that have been sent and received </FONT></HTML>");
          recv.setBackground(Color.black);
          JScrollPane pane
               = new JScrollPane(recv,
                         JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                         JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          pane.setBounds(10,10,290,100);
          type = new JTextArea(); // message input box
          type.setFont(new Font("Arial",Font.PLAIN,15)); // font for message input box
          type.setLineWrap(true);
          type.setToolTipText("<HTML><Font color = black face = Arial> <center> Enter messages here </FONT></HTML>");
          JScrollPane typepane
               = new JScrollPane(type,
                         JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                         JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          typepane.setBounds(10,120,220,50);
          send = new JButton("Send");
          send.setBounds(235,120,65,50);
          send.addActionListener(this);
          send.setToolTipText("<HTML><Font color = black face = Arial> <center> Click to send message </FONT></HTML>");
          container.setBackground(Color.red);
          container.add(pane);
          container.add(typepane);
          container.add(send);
          type.addKeyListener(new KeyAdapter() {
               public void keyPressed(KeyEvent ke)
                    if(ke.getKeyCode() == KeyEvent.VK_ESCAPE) {
                         setVisible(false);
                    } else if(ke.getKeyCode() == KeyEvent.VK_ENTER) {
                                   clock = Calendar.getInstance();
                                   int min = clock.get(clock.MINUTE);
String time;
if ( min < 10 ) {
time = "["+clock.get(clock.HOUR_OF_DAY)+":0"+min+"] ";
} else {
time = "["+clock.get(clock.HOUR_OF_DAY)+":"+min+"] ";
                         if(type.getText().length() == 0) return;
                         { recv.setText("<HTML> <FONT Size = 4 color = red > <b> SENT: <b> </FONT> "+time+type.getText() + " <BR> <HTML>" );
                         type.setText("");
          type.addKeyListener(new KeyAdapter() {
               public void keyPressed(KeyEvent ke)
                    if(ke.getKeyCode() == KeyEvent.VK_ESCAPE) {
                         setVisible(false);
          send.addKeyListener(new KeyAdapter() {
                         public void keyPressed(KeyEvent ke)
                              if(ke.getKeyCode() == KeyEvent.VK_ESCAPE) {
                                   setVisible(false);
          recv.addMouseListener(new MouseInputAdapter() {
               public void mouseClicked(MouseEvent me) {
                    isFocused = true;
                    if(timer != null)timer.stop();
          this.setResizable(false);
          this.setSize(310,210);
          this.setTitle("MSNClone - Command Line Ver 1.0b - Instant Messaging Window");
          this.setLocation(300,300); // location of window when you run program
          this.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e)
                    setVisible(false);
                    if(timer != null) timer.stop();
               public void windowActivated(WindowEvent ae) {
                    isFocused = true;
                    if(timer != null) timer.stop();
               public void windowDeactivated(WindowEvent ae) {
                    isFocused = false;
          public void windowOpened( WindowEvent e ){
          type.requestFocus();
          this.setVisible(true);
          type.requestFocus();
          //sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
          //hwnd = tk.getNativeWindowHandleFromComponent(this);
          //timer = new Timer(500);
          isFocused = false;
          clock = Calendar.getInstance();
     } // end constructor
     public String toString()
          return user.toString();
     public void actionPerformed(ActionEvent event)
          clock = Calendar.getInstance();
          int min = clock.get(clock.MINUTE);
String time;
if ( min < 10 ) {
time = "["+clock.get(clock.HOUR_OF_DAY)+":0"+min+"] ";
} else {
time = "["+clock.get(clock.HOUR_OF_DAY)+":"+min+"] ";
          if((event.getSource() == type)||(event.getSource() == send)) {
               if(type.getText().length() == 0) return;
               {recv.setText("<HTML> <FONT Size = 4 color = red > <b> SENT: <b> </FONT> <HTML>"+time+type.getText());
               type.setText("");
public static void main (String args[]) {
     ChatDialog window = new ChatDialog ();
     window.show();

Similar Messages

  • Utl file - I need to get new line for each value

    I wrote an utl_file package to generate an html file. It is working fine, however, I am having difficulty formating my output.
    I like to have values returned one line at a time. For instance,
    Name:Sam Ok
    area code: 407
    phone: 333-4444
    picture: display here.
    It is displaying values on one line.
    Please help if you can. Here is the code.
    Thanks,
    sam
    CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
    P_Filename IN varchar2,
    p_Id IN mist_physician.mp_phys_Id%TYPE
    AS
    CURSOR C_mist IS
    SELECT mp_name,
    mp_update_datetime,
    mp_area_code,
    mp_phone,
    mp_address,
    mp_fax
    FROM Mist_Physician
    WHERE Mp_phys_id = P_Id;
    v_mp_name mist_physician.mp_name%type;
    v_mp_update_datetime mist_physician.mp_update_datetime%type;
    v_mp_areacode mist_physician.mp_area_code%type;
    v_phone mist_physician.mp_phone%type;
    v_mp_address mist_physician.mp_address%type;
    v_mp_fax mist_physician.mp_fax%type;
    V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
    BEGIN
    --Open The specified file to write into and get V_FileHandle.
    V_FileHandle := UTL_FILE.FOPEN('c:\mist_info', P_FileName, 'w');
    IF Utl_File.IS_OPEN(V_FileHandle) = FALSE THEN
    RAISE_APPLICATION_ERROR(-20000,'Error opening '||P_FileName||' for WRITE');
    END IF;
    Let's build the header file that will be inside the file that will  identify why thus file is created.
    utl_file.put_line(V_FileHandle,'#---------------------------------------');
    utl_file.put_line(V_FileHandle,'Name'||' : '||mist_Rec.mp_name);
    utl_file.put_line(V_FileHandle,'Date');
    utl_file.put_line(V_FileHandle,'Phone');
    utl_file.put_line(V_FileHandle,'Address');
    utl_file.put_line(V_FileHandle,'# Generated on: '||to_char(sysdate, 'Mon DD, YYYY (Dy) HH:MI:SS AM'));
    utl_file.put_line(V_FileHandle,'#-----------------------------------------');
    utl_file.put_line(V_FileHandle,' ');
    -- Next we will query data from the Movie table. Only data that are relevant.
    -- Using PUT_LINE, write text with the field arguments out to the file
    BEGIN
    FOR Mist_Rec IN C_Mist LOOP
    UTL_FILE.PUT_LINE(V_FileHandle,'Name'||':'||Mist_Rec.Mp_Name||','||'<img src=c:/our_website/co16.jpeg>');
    END LOOP;
    SELECT mp_name,
    mp_update_datetime,
    mp_area_code,
    mp_phone,
    mp_address,
    mp_fax
    INTO v_mp_name,
    v_mp_update_datetime,
    v_mp_areacode,
    v_phone,
    v_mp_address,
    v_mp_fax
    FROM Mist_Physician
    WHERE Mp_phys_id = P_Id;
    END;
    -- Now Close the file
    UTL_FILE.FCLOSE( V_FileHandle);
    EXCEPTION
    WHEN Utl_File.Invalid_Path THEN
    RAISE_APPLICATION_ERROR(-20001,'Error: Invalid Path');
    WHEN Utl_File.Invalid_Operation THEN
    RAISE_APPLICATION_ERROR(-20002,'Error: Invalid File Operation');
    IF Utl_File.IS_OPEN(V_FileHandle) = TRUE THEN
    Utl_File.FCLOSE(V_FileHandle);
    END IF;
    WHEN Utl_File.Invalid_Mode THEN
    RAISE_APPLICATION_ERROR(-20003,'Error: Invalid Mode');
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLCODE || '-'||SQLERRM);
    END Cr_Movie_PRV_HTML;
    /**********************End Of Mist*********************/

    Syntax is::
    UTL_FILE.NEW_LINE(filename, nuber-of-lines)
    CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
    P_Filename IN varchar2,
    p_Id IN mist_physician.mp_phys_Id%TYPE
    AS
    CURSOR C_mist IS
    SELECT mp_name,
    mp_update_datetime,
    mp_area_code,
    mp_phone,
    mp_address,
    mp_fax
    FROM Mist_Physician
    WHERE Mp_phys_id = P_Id;
    v_mp_name mist_physician.mp_name%type;
    v_mp_update_datetime mist_physician.mp_update_datetime%type;
    v_mp_areacode mist_physician.mp_area_code%type;
    v_phone mist_physician.mp_phone%type;
    v_mp_address mist_physician.mp_address%type;
    v_mp_fax mist_physician.mp_fax%type;
    V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
    BEGIN
    --Open The specified file to write into and get V_FileHandle.
    V_FileHandle := UTL_FILE.FOPEN('c:\mist_info', P_FileName, 'w');
    IF Utl_File.IS_OPEN(V_FileHandle) = FALSE THEN
    RAISE_APPLICATION_ERROR(-20000,'Error opening '||P_FileName||' for WRITE');
    END IF;
    utl_file.put_line(V_FileHandle,' ');
    -- Next we will query data from the Movie table. Only data that are relevant.
    -- Using PUT_LINE, write text with the field arguments out to the file
    BEGIN
    FOR Mist_Rec IN C_Mist LOOP
    --Let's build the header file that will be inside the file that will
    --identify why thus file is created.
    UTL_FILE.PUTF
    (file_handle, %s,'--------------------------');
    UTL_FILE.NEW_LINE(V_FileHandle, 1)
    UTL_FILE.PUTF (file_handle, '%s','Name'||':'||Mist_Rec.Mp_Name, )
    UTL_FILE.NEW_LINE(V_FileHandle, 1)
    .(Chang the below all u will get as u required)
    'Date'||' : '||Mist_Rec.mp_update_datetime,
    'Area Code'||' : '||Mist_Rec.mp_area_code,
    'Phone'||' : '||Mist_Rec.mp_phone,
    'Address'||' : '||Mist_Rec.mp_address,
    'Fax'||' : '||Mist_Rec.mp_fax,
    '# Generated on: '||to_char(sysdate, 'Mon DD,
    YYYY (Dy) HH:MI:SS AM')),
    '<img src=c:/our_website/co16.jpeg>'),
    -- UTL_FILE.PUT_LINE(V_FileHandle,'Name'||':'||Mist_Rec.Mp_Name||','||'<img
    --src=c:/our_website/co16.jpeg>');
    END LOOP;
    SELECT mp_name,
    mp_update_datetime,
    mp_area_code,
    mp_phone,
    mp_address,
    mp_fax
    INTO v_mp_name,
    v_mp_update_datetime,
    v_mp_areacode,
    v_phone,
    v_mp_address,
    v_mp_fax
    FROM Mist_Physician
    WHERE Mp_phys_id = P_Id;
    END;
    -- Now Close the file
    UTL_FILE.FCLOSE( V_FileHandle);
    EXCEPTION
    WHEN Utl_File.Invalid_Path THEN
    RAISE_APPLICATION_ERROR(-20001,'Error: Invalid Path');
    WHEN Utl_File.Invalid_Operation THEN
    RAISE_APPLICATION_ERROR(-20002,'Error: Invalid File Operation');
    IF Utl_File.IS_OPEN(V_FileHandle) = TRUE THEN
    Utl_File.FCLOSE(V_FileHandle);
    END IF;
    WHEN Utl_File.Invalid_Mode THEN
    RAISE_APPLICATION_ERROR(-20003,'Error: Invalid Mode');
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLCODE || '-'||SQLERRM);
    END Cr_Movie_PRV_HTML;
    /**********************End Of Mist*********************/

  • Getting # instead of new line - in smartform

    Hello,
    I am displaying a PDF in popup window, in which I am getting '#' instead of enter (Keyboard enter i.e. new line).
    Details -
    I have some text boxes, in which I can put the comments where user can press the enter on keyboard (new line character). When I look that comment on browser, I can see the enter pressed i.e. text is displayed on next line.
    But when I open a smartform, it shows me '#' instead on new line. FYI - If I look in infotype value, there also it shows '#', but I am able to get new line in browser (it doesn't show '#' in browser i.e. it works fine in browser).
    Only issue is with PDF or smartform.
    Thanks & Regards,
    Bhushan

    Hi BhuShaan,
    I understood your problem.
    I faced similar issue in smartforms while printing Longtext text with #(enter). I found a solution for the same.
    I got Text with # into ET_LONGTEXT Internal table. I have done below code
    data : ET_LONGTEXT     TYPE TABLE OF     BBP_PDS_LONGTEXT,
              ES_LONGTEXT     TYPE     BBP_PDS_LONGTEXT,
              ET_TDLINE     TYPE TABLE OF     TDLINE,
              ET_TDLINEF     TYPE TABLE OF     TDLINE.
    LOOP AT ET_LONGTEXT INTO ES_LONGTEXT.
      SPLIT ES_LONGTEXT-TDLINE AT cl_abap_char_utilities=>newline INTO TABLE ET_TDLINE .
      APPEND LINES OF ET_TDLINE TO ET_TDLINEF .
    ENDLOOP.
    You can try above logic. Good Luck.

  • Fnd_new_messages won't display "new line" in sswa

    I created a new message in FND_NEW_MESSAGE, and I can't get "new lines"/"carriage returns" to display properly.
    Can someone explain how to get this to work? I am currently using BR, enclosed in <>, to force newline.
    For Example: ( i am using the tag properly, but for this posting i need to use the spaces before after BR) Message_text = 'This is line 1 < BR > This is line 2 ' <BR>
    In SSWA, should display as: <BR>
    This is line 1 <BR>
    This is line 2
    <BR>
    however, displaying as:
    This is line 1 < BR > This is line 2
    Thanks

    If your requirement is to have custom html message rather then the standard message, you can pass ur custom html in OAFormattedtext bean
    --Mukul                                                                                                                                                                                                                                                                                                                                               

  • Content conversion receiver channel new line at end of file

    hi,
    when i create a file using content conversion i get new line at the end of the file.
    can someone tell me please how to avoid this?
    ( i don't use any end separators. i only use addheaderline = 0 and fieldfixedlength).
    Thanks
    Tomer

    Hi Tomer,
    I guess wrong thread.
    Edited by: sudhir tiwari on Sep 11, 2008 2:43 PM

  • New lines in a file

    I'm trying to find a good way to get new lines in a file, and while this works it also uses 100% CPU and is driving me nuts. At least the profiler says this is .run is using the most, and taskmanager gives it 100%. The file name changes every day.
    package net.st0rm.ss.loghandlers;
    import java.io.*;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Timer;
    import java.util.TimerTask;
    import net.st0rm.ss.Log;
    import net.st0rm.ss.gamecmdhandlers.GameCommandHandler;
    import net.st0rm.ss.irc.IRC;
    public abstract class LogHandler {
         public static ArrayList<GameCommandHandler> gameCmdHandlers = new ArrayList<GameCommandHandler>();
         private BufferedReader reader = null;
         private File directory = null;
         private LogReadThread thread = null;
         private String thisLine = null;
         private boolean skip = true;
          * Time to wait between reads
         private Long delay = 100L;
          * Creates a new instance
          * @param directory Directory of the files used
          * @param skip Should the reader skip lines already existing?
         public LogHandler(File directory, boolean skip) {
              this.directory = directory;
              this.skip = skip;
         public String getFileName() { return ""; };
         private class LogReadThread extends Thread {
              public boolean stop = false;
              public void run() {
                   Calendar c = Calendar.getInstance();
                   c.set(Calendar.HOUR_OF_DAY, 23);
                   c.set(Calendar.MINUTE, 59);
                   c.set(Calendar.SECOND,59);
                   StringBuilder sb = new StringBuilder(1000);
                   new Timer("Restart Timer").schedule(
                             new TimerTask() {
                                  public void run() {
                                       try {
                                            Thread.sleep(3000);
                                       } catch (InterruptedException e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                       IRC.getInstance().msg("Restarting reader \"" + this.getClass().getSimpleName() + "\" for the new day.");
                                       LogHandler.this.restartReader();
                             ,c.getTime(), 3600000*24);
                   try {
                        reader = new BufferedReader(new FileReader(directory.getAbsolutePath() + "/" + getFileName()));
                        if (skip) while ((reader.readLine()) != null);
                        while (!stop) {
                             try {
                                  Thread.sleep(delay);
                             } catch (InterruptedException e) { System.out.println("Thread Interupted!"); }
                             while ((sb.append(reader.readLine())).toString() != null) { onNewLine(sb.toString()); sb.delete(0, sb.length()); }
                        reader.close();
                   } catch (IOException e) {
                        Log.log(e);
          * Call to re-start the file stream
         public void restartReader() {
              if (thread != null) thread.stop = true;
              thread = new LogReadThread();
              thread.start();
          * Called when a new line is added to the file
          * @param line The line added
         public void onNewLine(String line) { }
    }

    I don't know what anybody can say other than "debug and profile your code".
    It's weird that you have a Thread.sleep in the run method of a TimerTask. Why not just change the scheduling of the task?
    This:
    while ((sb.append(reader.readLine())).toString() != null) {
        onNewLine(sb.toString());
        sb.delete(0, sb.length());
    }(reindented to make it easier to read) is fishy. Even when you reach the end of reader's input, I think it will just loop forever. That's because appending null to a string buffer and calling toString results in the string "null", not the value null. So that while loop will never end.
    Good luck.

  • Siri command "new line" in Siri not working while texting directly in Siri?

    Hi,
    Seems that "new line" and "paragraph" don´t work in the Siri GUI - at least the German pendants "Neue Zeile" and "Neuer Absatz" don´t work on my 4S.
    It works fine in apps like mail but not when creating a mail directly dictaed to Siri..
    Thx
    Sebastian

    I am able to get "new line" to work consistently in NOTES. However, it took a while for SIRI to learn what I wanted. At first, SIRI would type out the command. Then I would enter return from the keypad. After about 6 cycles, she learned it and started skipping ta a  new line. I'm not sure what I am going to do when I want to actually type "new line" !  There should be a hot word to use to let SIRI know to interpret the next word as a command suggestion. But I solved my new linds issue.

  • HT5449 Cannot Dictate "New Line" for a return key stroke.

    When using dictation I can't get "New Line" to work. It simply types this phrase! The "New Paragraph" command works, but adds all these additional spaces into my text. Has anybody got ideas on how to resolve? Is there another way to dictate a "return key"?

    I understand.
    Perhaps Apple Support in Australia would be willing to answer that one for you.  Their phone number is:
    (61) 1-300-321-456
    Or I wonder if there is some term used in Australia that means "new line" that might work (such as "return").  "Return" does not generate a new line here.

  • A new line is showing up on messages I receive. It's seems to be a row of links, including a URL to (maybe) the msg source. How do I get rid of it?

    On my incoming messages, under my toolbars & above the msg header, is a new line. It sort-of looks like another toolbar, but different. It reads from left to right and each word is highlighted white:
    Back Forward Refresh URL: ___________________ Go
    Each of these words except for "URL:" are in boxes as if they are links but they don't work like links.
    What is this and how do I get it off my incoming messages?
    Thanks, nanciewanda

    I have no idea. Perhaps you could post the troubleshooting information so we can have a better look at what is going on.
    Click the Help menu (Alt+H) and select ''Troubleshooting Information'' from the menu.
    Now, a new tab containing your troubleshooting information should open.
    *At the top of the page, you should see a button that says "Copy text to clipboard". Click it.
    *Now, go back to your forum post and click inside the reply box. Press Ctrl+V to paste all the information you copied into the forum post.

  • Add a new line to get Iphone 4s instead of ETF?

    Could I add a line to our family share plan to get the Iphone 4S, and after activation on the same day switch the Iphone to my current phone line # on the same plan, and then add an old non data phone to the new line added to buy the iphone? That way I get the Iphone at the 2 year price and not have to pay a early termination fee, plus I get to keep my current phone # and unlimited data? Will this work? Help please!

    I would be buying this from a verizon store. I went tonight to buy the iphone 4s and I was told I couldn't because last May I decided to pay the difference for a new phone instead of getting the same phone they had replaced many times and I kept having issues with having poor reception quality. So I bought my current Droid X for $199.99 plus $20 more for the early upgrade fee, so I got no discount. I am told today that I used my upgrade in May so I have to wait until January of 2012 to upgrade to Iphone 4S or any other phone unless I pay retail price of $649.99. So my husband and I decided to see if it would be worth just adding a new line and switching the phones around. Do you see me getting any grief for doing this?

  • How do you get a new line in a description of an iCal event?

    I need to be able to create multiple lines in a description of an iCal event.  In the past, I used control return to get a new line.  In Mountain Lion, this does not show up as a new line, once the event has been saved.  It merges all of the text onto one line and creates new lines as the space dictates.  How can I force new lines in the event description between the words that I have chosen?

    I'm interested too.
    Please help, I had own method to management  iCal's event – new line, of 10.7 worked great – now is a little terrible for me :/

  • I plan on buying a new  I Pad wit wifi and cell from Apple. But  I don't want to select a cell carrier right now. Q 1: Do I have to select a carrier at purchase? and Q 2, In the meantime will I be able to get on line at home using my Cox Internet wi fi co

    I plan on buying a new  I Pad wit wifi and cell from Apple. But  I don't want to select a cell carrier right now. Q 1: Do I have to select a carrier at purchase? and Q 2, In the meantime will I be able to get on line at home using my Cox Internet wi fi? Thanks. 

    Thanks for the help. Now I can feel comfortable in not having to sign up for cellular when I buy, esp. Since I'll be using my new IPad mostly at home on my Cox wi fi. Then I can see, in using the i pad, how often I'd actually use the cellular, and where. This can help decide which type of cell plan I get. Small problem it may seem, but a very helpful answer. Thanks.

  • I'm having problem with text boxes.  Whenever i hit the enter button to start a new line or paragraph, the cursor doesn't drop down to the next line.  Instead i get this little red + sign in the box.

    I'm having problem with text boxes.  Whenever i hit the enter button to start a new line or paragraph, the cursor doesn't drop down to the next line.  Instead i get this little red + sign in the box.

    You are absolutely right.  Thought Enter meant Enter.  I was wrong.  Thank you for the help.
    Rod Rogers, Broker
    Accredited Land Consultant (ALC)
    Metcalf Land Company, Inc.
    Office: 864-585-0444
    Mobile: 864-316-0297
    Fax: 864-583-6000
    <http://www.metcalfland.com> www.metcalfland.com

  • Cant get it to replace or print to new line, please help

    2 problems. The instructions are to first replace each 's' with '$' and then print each word to a new line. Here is an example:
    Give me a phrase: Viva Las Vegas, babies!
    Viva
    La$
    Vega$,
    babie$.
    Here is my code that is not working:
    import java.util.*;
    public class StringEdit {
         private static Scanner input ;
         private static String makeMoney[] ;
         public static void main(String[] args)throws Exception {
              System.out.print ("Give me a phrase: ") ;
              input = new Scanner (System.in) ;
              makeMoney = input.nextLine().split(" ") ;
              //makeMoney = makeMoney.replace("s", "$") ;
              int i = 0;
              while (i < makeMoney.length) ;{
              if (makeMoney.contains("s")){
                   System.out.println("Show me here");
                   makeMoney[i].replace("s", "$");
              if (makeMoney[i].contains("S")){
                   System.out.println("Show 2");
                   makeMoney[i].replace("S", "$");
              System.out.print(makeMoney[i].toString());
              i++ ;
    Please help me figure out what is wrong

    your first post was the one which you really wanted to use for the assignment in order to get the output you desire. anyways like jverd said that you cannot update string because they are immutable. you can always do this
    makeMoney[i] = makeMoney.replace(blah blah).
    here is your program
    import java.util.*;
    public class StringEdit {
         private static Scanner input ;
         private static String makeMoney[] ;
         public static void main(String[] args)throws Exception {
              System.out.print ("Give me a phrase: ") ;
              input = new Scanner (System.in) ;
              makeMoney = input.nextLine().split(" ") ;
              //makeMoney = makeMoney.replace("s", "$") ;
              int i = 0;
              while (i < makeMoney.length) {
              if (makeMoney.contains("s")){
                   System.out.println("");
              makeMoney[i] =     makeMoney[i].replace("s", "$");
              if (makeMoney[i].contains("S")){
                   System.out.println("");
              makeMoney[i] =      makeMoney[i].replace("S", "$");
              System.out.print(makeMoney[i].toString());
              i++ ;
    output
    Give me a phrase: Viva Las Vegas
    Viva
    La$
    Vega$Message was edited by:
    fastmike

  • I made a video series on one time line and now want to copy paste sections into other tiemlines so I can separate the series into distinct videos to upload. How do I get new timelines? When I go to new event it asks for import footage.

    I made a video series on one time line and now want to copy paste sections into other tiemlines so I can separate the series into distinct videos to upload. How do I get new timelines? When I go to new event it asks for import footage.

    You seem to be new to this software, so I highly recommend that you take some time to learn it using some great tutorials available online - it will pay off to invest the time, if you follow through, for example the great (and free) introductory tutorial at izzyvideo.com.
    This is an amazing piece of software, and you'll have a lot to learn, but it's well worth it.

Maybe you are looking for