I am writing a small database that requires user input.
However, whenever something is output to the screen, the cursor stays at the
beginning of the output instead of the end of the output.
How can I let it go to the end of the output?
For example:
say, the output is like this:
This is a database. Please input your information below.
prompt:>
I want the cursor to go to after the ">" sign but it stays in front of
"this" although whenever the user presses the keyboard it goes the end after
">".
This is not a big problem but makes my application look not so professional.
Anyway to cure this?
John
..
>This is not a big problem but makes my application look not so professional.
Nothing in a console has 'looked professional' for
around the last 2 decades.
>Anyway to cure this?
GUI e.g.
<sscce>
import javax.swing.JOptionPane;
class DataBaseFrontEnd {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null,
"<html><body><center>Welcome to the " +
"<br><em>XYZ DataBase Application</em>");
String response = JOptionPane.showInputDialog(null,
"Please enter your information ");
JOptionPane.showMessageDialog(null,
"Sending to D/B: '" + response + "'");
}
}
</sscce>

Signature
Andrew Thompson
http://www.athompson.info/andrew/
John Hartnup - 24 Apr 2007 09:03 GMT
> .
>
> >This is not a big problem but makes my application look not so professional.
>
> Nothing in a console has 'looked professional' for
> around the last 2 decades.
Don't be ridiculous. For example, no serious UNIX database would ship
without a text mode admin tool.
John, you probably need to add some more detail to your question. What
sort of output are you using? An MSDOS window? A UNIX terminal
emulator? The Eclipse console?
What are you using to output your text? System.out.println()? Some
kind of screen handling library?
What are you using to collect input? System.in.read()? The
aforementioned screen handling library?
John - 24 Apr 2007 13:54 GMT
>> .
>>
[quoted text clipped - 16 lines]
> What are you using to collect input? System.in.read()? The
> aforementioned screen handling library?
John - 24 Apr 2007 13:58 GMT
My input is scanner.nextline();
output is System.out.print()
System.out.print() or println doesn't make much difference since I can
always add "\n" to the end of message.
The console here is Eclipse console in windows xp.
I haven't tried dos window yet.
Not a big deal. Just not so professional.
John
>> .
>>
[quoted text clipped - 16 lines]
> What are you using to collect input? System.in.read()? The
> aforementioned screen handling library?
Martin Gerner - 25 May 2007 15:06 GMT
> The console here is Eclipse console in windows xp.
> I haven't tried dos window yet.
I can't say this for absolute certain, but I am quite sure that if you were
to try out your program in a "normal" console - like XP's command prompt -
it would look correct.
I quickly checked one of my own programs - which also uses
System.out.println and Scanner.nextLine() - and the cursor behaves as it
should, both in XP's command prompt and on a linux console.

Signature
Martin Gerner