Re: Clear the Screen

From: nos (nos_at_nospam.com)
Date: 01/09/04


Date: Fri, 09 Jan 2004 15:04:19 GMT

But if they can implement "beep", and they do,
they should be able to implement "cls" too.

"Anthony Borla" <ajborla@bigpond.com> wrote in message
news:g0yLb.2893$Wa.1516@news-server.bigpond.net.au...
>
> "Denz" <RUBBISH@RUBBISHhotmail.com> wrote in message
> news:KvlLb.1671$Wa.792@news-server.bigpond.net.au...
> >
> > Ive seen this question before- with no real solution.
> > Surely it wouldnt have been difficult to provide a clear
> > screen, and even basic screen cursor positioning?
> >
> > It would make text-mode java alot more useful.
> >
>
> Unfortunately these tasks are inherently operating system-specific, and
> cannot be implemented in any standard way across platforms. Some
platforms,
> in fact, don't even understand the concepts of 'screen', or 'cursor', so
> wouldn't even have any use for classes that implemented these
abstractions.
> Even the 'standard' C and C++ languages which, like Java, aim for platform
> independance, do not implement such functionality.
>
> System-specific tasks such as these may be performed via:
>
> * 'Runtime.getRuntime().exec(...)'
>
> * Writing Java Native Interface [JNI] routines which tap into
> the relevant operating system functionality
>
> The first option should really be seen as a 'quick and dirty' approach -
it
> allows you to perform certain system-specific tasks but with very little
> control. A program, to be considered robust, would make no more than
sparing
> use of this facility. If you find you are relying on it heavily you may
need
> to seriously question whether Java is the ideal development tool for this
> task [a scripting language (Perl, Python) might be more suitable ?], or
more
> of a development commitment needs be made by using JNI.
>
> There is nothing inherently wrong with JNI except that its use helps
defeat
> one of Java's most important qualities - platform independance - and it
> introduces 'weaknesses' into the application because program execution
> occurs outside the control of the JVM, and any failure here could be
> catastrophic. On the flipside, Java would be a very limited development
> environment without it since it allows for the tapping into
system-specific
> functionality in a controlled, and efficient way.
>
> So, to provide the facilities you seek, you need to implement suitable JNI
> routines. Again, options are available:
>
> * Tap into someone else's work. As another respondant has
> already meantioned, the JCurses package provides a
> reasonable suit of screen handling routines for the *NIX
> and Windows-familiy platforms
>
> * Write your own. This isn't as difficult as you might imagine,
> and might be the best approach if all you require is a
> few simple routines like:
>
> - Clearing the screen
> - Moving the cursor to specified positions
> - Accepting input [say a single keystroke] without pressing
> ENTER
>
> A good start would be the JNI tutorial at the Sun site, and,
> of course, perusal of the documentation for the system
> functions implementing this functionality
>
> Anyway, apologies for the longwindedness of the response. Hopefully,
though,
> some useful insights have been provided.
>
> Cheers,
>
> Anthony Borla
>
>



Relevant Pages

  • Re: HELP I am about to quit on AS2005
    ... I miss Undo/Redo functionality in VS2005. ... make comlex involving stuff a breeze, but at the expense of control on the ... I feel the MDX syntax needs more ... SQL server manager managegement studio and MDX for data access. ...
    (microsoft.public.sqlserver.olap)
  • Re: Clear the Screen
    ... cannot be implemented in any standard way across platforms. ... Even the 'standard' C and C++ languages which, like Java, aim for platform ... do not implement such functionality. ... of a development commitment needs be made by using JNI. ...
    (comp.lang.java)
  • Re: Moving MsgBox
    ... you need to provide the same functionality which includes ... The taskswapper is a fully functional, ... necessary to use it as an OCX, and compiled the AX control. ... Memory footprint or combined file sizes? ...
    (microsoft.public.vb.general.discussion)
  • RE: [Full-Disclosure] Psexec on *NIX
    ... >> So you want all the functionality of psexec without installing psexec? ... >> You want to remote control any windows machine from your linux laptop? ... > not full control but just enough to start one program which would be run and copied on the targer machine only when the source machine has a username / passwd combo ...
    (Full-Disclosure)
  • Re: Drawing lines - another noob question
    ... It's a difficult question to answer regarding OOP. ... At the simplest level OOP combines the two so data and functionality exist ... Interfaces allow you to control polymorphism so that you don't create huge ... I was finally able to get the picturebox writing method to work. ...
    (microsoft.public.dotnet.languages.csharp)