[RESOLVED] showing all the input
I dont like this sequence because i should input first the name before showing the next input fields i want to happen is showing all the input fields then i can use the arrow keys to scroll up and down.
Code:
System.out.print("Enter Your Name: ");
name =input.readLine();
System.out.print("Enter Your Age: ");
age =input.readLine();
System.out.print("Your Address: ");
add = input.readLine();
This is i want to happen:
Enter Your Name:________
Enter Your Age:__________
Your Address:___________
Re: showing all the input
Try this
Code:
public static void main(final String[] args)
{
final Scanner input = new Scanner(System.in);
System.out.print("Enter Your Name: ");
final String name = input.nextLine();
System.out.print("Enter Your Age: ");
final int age = input.nextInt();
System.out.print("Your Address: ");
input.nextLine();
final String add = input.nextLine();
System.out.println("You are \"" + name + "\"\nYou are \"" + age + "\" years old.\nYou live in: " + add);
}
Re: showing all the input
thanks! but this is not i want to happen in the program.
i want to happen is all the input fields will showing at the same time then you can type which you want to input data first. is just like a form.
Re: showing all the input
Re: showing all the input
is just like a gui swing but i want to make on a console can you do that?
what is the code for that?
Re: showing all the input
Check this guy out:
http://rghosh.free.fr/text_console.html
He's written a couple of classes with which you can do exactly what you want.
Re: showing all the input
Quote:
Originally Posted by
monotonehell
the given link is made of gui. but is it possible to make on a console?
Re: showing all the input
Oh sorry I misread - I thought you wanted to emulate the look and feel of a console on top of a GUI.
Not sure how to implement that without some kind of fake-gui, like Ncurses.
Could be a load of work but maybe look at some or all of these:
http://www.pitman.co.za/projects/charva/
http://sourceforge.net/projects/javacurses/
Or if you're really game roll your own. ;)
http://plindenbaum.blogspot.com/2008...-notebook.html