|
-
Nov 30th, 2009, 09:15 AM
#1
Thread Starter
Addicted Member
[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:___________
-
Nov 30th, 2009, 11:15 AM
#2
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);
}
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Nov 30th, 2009, 11:03 PM
#3
Thread Starter
Addicted Member
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.
-
Dec 1st, 2009, 02:13 AM
#4
Re: showing all the input
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Dec 1st, 2009, 03:28 AM
#5
Thread Starter
Addicted Member
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?
-
Dec 1st, 2009, 11:33 PM
#6
Junior Member
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.
-
Dec 2nd, 2009, 01:02 AM
#7
Thread Starter
Addicted Member
Re: showing all the input
 Originally Posted by monotonehell
the given link is made of gui. but is it possible to make on a console?
-
Dec 2nd, 2009, 04:07 AM
#8
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|