Results 1 to 6 of 6
  1. #1
    eyal3400 is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Lightbulb how to blank an output screen?

    i have started working with java a week ago however i have background with JavaScript.
    my problem is that i don't know how to clear the output window so:


    import java.util.Scanner;
    public class hi5 {
    public static void main (String args[]){
    Scanner A = new Scanner (System.in);
    //anything is put on the output
    System.out.println("anything");
    //the output will be anything, however now how do i erase this line from the output box?
    //in addition when u input anything
    int a = A.nextInt();
    //the input value u have just typed stays on the screen after you have pressed the enter
    //buttom, and i would like to know how to make the input value disappear when u enter it
    }
    }

    help would be greatly appreciated, thx

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

    Default

    Some consoles have commands to clear. On others you could write enough blank lines to push shown lines out of sight.
    Otherwise consoles are not for fancy GUI like stuff. Use a GUI if you want that kind of control.

  3. #3
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Clearing the terminal is OS dependent, I am not sure but i think GNU's ncourses can clear the terminal, if so, the Java library jcourses may also be able to do so for Windows and GNU (Linux).

    However if you are using GNU you just need to print "\033c" for clearing the screen or "\033[2J" for clearing the display (previous lines will be stored, but only visible if scrolling up).
    Several commands like this (for example colouring) exists, and some of the magick follows the specifications for VT100.

    If you are using Windows or DOS I hear these command does work, but for newer version of Windows (maybe it was XP and newer) you must explicitly enable ANSI.SYS,
    but I do not know how to do that.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  4. #4
    eyal3400 is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    thx i will try to look into it more

  5. #5
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Please notify me by mail [hibernate@linuxmail.org] if you get it to work in Windows.
    It would be awesome to get more of my stuff to work in Windows.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  6. #6
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by Norm View Post
    Some consoles have commands to clear. On others you could write enough blank lines to push shown lines out of sight.
    Otherwise consoles are not for fancy GUI like stuff. Use a GUI if you want that kind of control.
    Yes that is exactly what consoles are for, just look at:
    nvlc (that is VLC with some extra parameters), less, emacs, nano, Opera-Next installer, Arch Linux' installer, gpm &a
    Last edited by Hibernate; 08-05-2011 at 02:21 AM.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

Similar Threads

  1. Replies: 6
    Last Post: 07-01-2011, 03:20 AM
  2. Move from one screen fto other screen
    By jprgmr75 in forum CLDC and MIDP
    Replies: 0
    Last Post: 01-02-2011, 06:32 PM
  3. Blank screen
    By dewitrydan in forum New To Java
    Replies: 14
    Last Post: 08-12-2010, 05:19 PM
  4. Blank space
    By sandy1028 in forum New To Java
    Replies: 1
    Last Post: 04-21-2009, 10:00 AM
  5. Blank Screen while navigating from one screen to another
    By mohana.krishna in forum Java Servlet
    Replies: 0
    Last Post: 03-03-2009, 05:03 PM

Posting Permissions

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