Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    Smile Need For Clear Screen

    Hi Friends In We Write Clrscr() Function .similarly Is There Any Function Like That In Java.
    Then Specify Function With Package Also...

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you explain what you want to do exactly? What your Clrscr() function do? You must provide more details if you want to find a solution.

  3. #3
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    no api in java that does that. (non that i know of anyways.) just use println("\n\n\n\n\n\n\n\n\n\n\n\n");
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    what angryboy said, but you may want to use an excess of line breaks. it really depends on the size of the terminal.

  5. #5
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    i here by declare the first java clrscr()!!

    Java Code:
      public static void clrscr(){
        for(int i=0; i<1000; i++)
          System.out.print("\n\n\n\n\n\n\n\n\n\n");
          // a set of 10 newlines.
      }
    i think 10k \n should be enought on both unix and dos.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Is this what our thread starter wants to find? He's talking about clearing up something, here just printing large number of new line characters. So not empty, right.

  7. #7
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default

    Eranga: What the OP is looking for is a "clear screen" method ... sort of like what C has. This method doesn't exist in Java, so what AB suggests is to just print an enormous amount of new lines to clear the screen.

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  8. #8
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    thanks for clearing that up chris. :)

    actually, i realize that you can't always assume there is a console to print to. So its better to use Console.printf instead (if its not null, that is).
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by CJSLMAN View Post
    Eranga: What the OP is looking for is a "clear screen" method ... sort of like what C has. This method doesn't exist in Java, so what AB suggests is to just print an enormous amount of new lines to clear the screen.

    CJSL
    Yes Chris, I'm clear on with what AB post in his earlier post. But the question is, just not like in C, here printed some new lines. What I wonder is either C doing this. Because new line is a character, as far as I believe. If so the screen is not empty.

Similar Threads

  1. 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
  2. Clear Screen in Console based programs
    By kirly in forum New To Java
    Replies: 5
    Last Post: 02-05-2009, 05:59 AM
  3. Please clear my doubt...............
    By vinaytvijayan in forum Advanced Java
    Replies: 0
    Last Post: 12-26-2007, 06:23 PM
  4. Help, someone clear up Interfaces for me
    By mathias in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 02:26 AM
  5. Clear screen in java
    By lenny in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 09:43 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
  •