Results 1 to 4 of 4
  1. #1
    Tamu is offline Member
    Join Date
    Nov 2008
    Posts
    19
    Rep Power
    0

    Default How to erase line(s) from a console?

    Hello!

    I am using Eclipse classic to write java source code. I got stuck at the following problem:

    How to erase written line(s) from eclipse console?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,463
    Rep Power
    25

    Default

    Does eclipse have doc for an API to do that? For example can you specify which line to write the output to?
    Backing up and overwriting console output is not part of the Java API.

  3. #3
    Tamu is offline Member
    Join Date
    Nov 2008
    Posts
    19
    Rep Power
    0

    Default

    Sorry that my question is not understandable. Here is better one

    [The given code is just a quick example]

    Let say that one numeric input from a user is one event.

    If the user makes fifty events, then the console is very "long" (or "deep").
    The question is how I can make the console shorter for example by
    erasing lines of the first to fortieth's event.

    If erasing is possible then how?

    In java api there is a class, ConsoleHandler - can't see any method that erase

    After reading Norm's last sentence, it led me to conclusion that my problem is impossible to solve. - At least in java api.

    Thanks for the reply anyway :)

    Java Code:
    import java.util.Scanner;
    
    public class PrintHello {
    	public static void main(String[] args){
    		Scanner input = new Scanner(System.in);
    		int choice;
    		do{
    			System.out.println("Give number of times that \"Hello\" will be printted");
    			System.out.println("Give zero as a numeric value to stop the loop");
    			choice=input.nextInt();
    			for(int traveller=0;traveller<choice;traveller++){
    				System.out.println("Hello");
    			}
    		}while(choice!=0);
    	}
    }

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    It is not possible. If you want this functionality, you should create a GUI app. I recommend you study Swing.

Similar Threads

  1. Reading a line from console using Scanner class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-18-2008, 11:52 AM
  2. Console doesn't appear!
    By PeteMarsh in forum New To Java
    Replies: 2
    Last Post: 12-17-2007, 05:41 PM
  3. Reading in data from file line by line
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 10-02-2007, 12:19 AM
  4. Help with java console
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 02:44 PM
  5. How do erase image drawn
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 05:26 AM

Posting Permissions

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