Re: Clear the Screen

From: Tony Morris (dibblego_at_optusnet.com.au)
Date: 01/11/04

  • Next message: Tony Morris: "Re: Newbie: What is "cond" in the following code?"
    Date: Sun, 11 Jan 2004 10:24:01 +1000
    
    

    It would defeat the purpose of platform-independance, since not all
    platforms have the concept of a "console".

    -- 
    Tony Morris
    (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    Software Engineer
    IBM Australia - Tivoli Security Software
    "Denz" <RUBBISH@RUBBISHhotmail.com> wrote in message
    news:Hz%Lb.4898$Wa.2751@news-server.bigpond.net.au...
    > Something like this Console class would be great.
    > Ive just downloaded JCurses but so far looks like overkill- when just a
    few
    > methods like clear screen and cursor position would go such a long way...
    >
    > "Anthony Borla" <ajborla@bigpond.com> wrote in message
    > news:yAJLb.3537$Wa.407@news-server.bigpond.net.au...
    > >
    > > "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message
    > > news:btmocn$cis$1@sun-cc204.lut.ac.uk...
    > > > While it was 9/1/04 3:04 pm throughout the UK, nos sprinkled little
    > > > black dots on a white screen, and they fell thus:
    > > >
    > > > > But if they can implement "beep", and they do,
    > > > > they should be able to implement "cls" too.
    > > > <snip top of upside-down reply>
    > > >
    > > > That's because BEL is a standard ASCII character
    > > > (code 7) and it's pretty much standard that any terminal/console
    > > > would render it by beeping.
    > > >
    > >
    > > Try it on an IBM mainframe - they use EBCDIC, not ASCII ;) !
    > >
    > > >
    > > > OTOH, for some reason I can't imagine FF (12) doesn't
    > > > standardly mean clear screen, and nor does any other
    > > > ASCII string.
    > > >
    > >
    > > You'll find that 'plain vanilla' *NIX / Linux systems *do* exhibit
    fairly
    > > consistent console behaviour; it's the Windows-family environments that
    > > exhibit such inconsistencies.
    > >
    > > >
    > > > But I agree that having a portable means of screen clearing
    > > > would be handy.
    > > >
    > >
    > > Maybe a nested class could be added to 'System', containing all the
    > > system-specific console-management routines, something like:
    > >
    > >     class System
    > >     {
    > >         ...
    > >         public class Console
    > >         {
    > >             ...
    > >             public static native void cls();
    > >             public static native void setCurPos(int row, int col);
    > >             public static native String inputString();
    > >             public static native double inputNumeric();
    > >             ...
    > >         }
    > >         ...
    > >     }
    > >
    > > You could then do something like:
    > >
    > >    System.Console.cls();
    > >
    > > to clear the screen, and something like:
    > >
    > >    String name;
    > >
    > >    System.Console.setCurPos(10, 35);
    > >    System.out.print("Enter your name: ");
    > >    name = System.Console.inputString();
    > >
    > > Platforms that did not support consoles or the like could then simply
    have
    > > dummy [i.e. empty] methods ?
    > >
    > > Maybe if the Sun Java developers were lobbied by enough developers they
    > > might consider building this functionality into the API ?
    > >
    > > I suspect, though, they will simply leave it to developers requiring
    > console
    > > management support to use JNI, either directly, or by downloading a
    > package
    > > like JCurses.
    > >
    > > >
    > > > BTW, have the rest of you people stopped telling people
    > > > to try what you can't be bothered to try for yourself?
    > > >
    > >
    > > I think their intentions were sincere, and probably did do some testing
    on
    > > their own systems. The error was in assuming that the same behaviour
    could
    > > be expected on other systems. My general view is that any constructive
    > > response is to be welcomed and appreciated.
    > >
    > > Cheers,
    > >
    > > Anthony Borla
    > >
    > >
    >
    >
    

  • Next message: Tony Morris: "Re: Newbie: What is "cond" in the following code?"

    Relevant Pages

    • Re: Any Clojure users here?
      ... even need to recompile your programs for different platforms. ... What is there beyond console and file io? ... Which the JVM has to do too. ... you can saturate the CPU on old, slow, single-core hardware and be ...
      (comp.lang.lisp)
    • Re: Dragon Age dated: October 20
      ... -0500, Anno Domini: ... Bzzzt. ... that the PC version will be distinct from the console versions and take ...
      (comp.sys.ibm.pc.games.rpg)
    • Re: Dragon Age dated: October 20
      ... -0500, Anno Domini: ... that the PC version will be distinct from the console versions and take ... The Xbox 360 and PS3 versions are basically ports of the PC version. ...
      (comp.sys.ibm.pc.games.rpg)
    • Re: 360 has most developers (74% of all developers working on 360)
      ... said that they were making games for either the PC or Mac. ... platforms, combined as a whole, amounted to 43-percent of the pie; ... Upon further analysis of the console figures, ... developers in North America who read either Gamasutra.com or Game ...
      (alt.games.video.xbox)
    • Re: freebsd 5.3 on ultra5
      ... The standard solution (on all platforms, but not used very much on i386 ... the install via a serial console if the native console doesn't work. ... somebody reported that even if the arrow keys don't work on the ...
      (comp.unix.bsd.freebsd.misc)