dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: tell a program to delete text?

  1. #1
    Join Date
    Oct 2004
    Posts
    6

    tell a program to delete text?

    Hello all -
    I am currently in JAVA I, so please bare with me. We are writing really simple programs, but i guess im a good student cause i always get done first and add more crap. Question is:

    Is there a way to make a JAVA program (Class:main) delete output text that we tell our program to write?

    Example: System.out.print("Hellol");
    <I want to be able to make the program delete that>
    System.out.print("Hello");

    I know that I can always re-print this text to make it look like it deleted the word, but thats not my style. Please help, this is killing me.

    Also, I often make the program look like it is 'typing' words, like this:
    Thread.sleep(90);
    System.out.print("H");
    Thread.sleep(90);
    System.out.print("e");
    Thread.sleep(90);
    System.out.print("l");
    Thread.sleep(90);
    System.out.print("l");
    Thread.sleep(90);
    System.out.print("o");

    yup... too much time on my hands... anyways, I know there is an easier way to do this, with a String and a For loop perhaps, but i dont know what to type... Please help with this, also... Thanks.

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,137
    I don't think once you have text on the console,you can delete it unless you reprint...there may be an option where you can run a dos command to clear the console....lets see if some one else understood your question better and come up with a solution..
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Very system dependent but on some systems you can print backspace-space-backspace to delete the last character printed to a line and position the cursor to overwrite that position.

  4. #4
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,137
    did you want continous input from user? if so that you are able to delete
    System.in
    is something to read on if this is the case.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  5. #5
    Join Date
    Oct 2004
    Posts
    6

    hmm

    i wasnt planning on having the user input anything, im trying to have the program do basically all the work.... by the way i did find a loop for the 2nd question, thanks for thinkin about it anyways :-).
    Khalid, I think you were closer the first time when you said about reprinting, ray ill try that clearing thing. Basically ive come up with so far is i can reprint everything ive already printed, leaving out a letter or word, making it seem like it has been deleted, but its not my style, again, i think it would look bad to be able to scroll up and the user say 'what a stupid trick'.... If you guys cant rack your minds for anything else, I understand, as my friend keeps telling me about how smart you are Khalid Ali. Thanks for the quick replies!

  6. #6
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,137
    unless you write something that continously wait for an input, a java program will end as soon as you have printed a System.out statement.
    This means you have no ability to go back and clear it...make sense..???
    let me know if it does then we'll go from there...
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  7. #7
    Join Date
    Oct 2004
    Posts
    6
    yup. it does... but assuming I don't want users to input anything to delete it... its impossible?

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles