| | |
Need Help on showInputDialog
![]() |
•
•
Join Date: Nov 2004
Posts: 7
Reputation:
Solved Threads: 0
Hi,
i am new to java.....
i was wondering if someone can hlep me with the code to substitute the use of showInputdialog.
currently i am using the following code to recieve Strings, but i do not want to use the java dialog boxes. is it possible to do something like c++ has (cin)?
my code is as follows:
blah blah
thx in advance..... or can someone help fix my code so that i can then compare price with a + sign, or = sign or an int.....?
thx
ra2833
i am new to java.....
i was wondering if someone can hlep me with the code to substitute the use of showInputdialog.
currently i am using the following code to recieve Strings, but i do not want to use the java dialog boxes. is it possible to do something like c++ has (cin)?
my code is as follows:
blah blah
Java Syntax (Toggle Plain Text)
String price = ""; // initialized the variable price to empty string ArrayList keypad = new ArrayList(); // create an arraylist and name it // keypad while (true) // continuous loop to stop when arrayList is // empty { try // read data from console { BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1); System.out.println("Enter price"); System.out.flush(); price = br.readLine(); } catch (IOException ioe) // if error then catch error { System.out.println(ioe); } keypad.add(price); // put data read from console into stack
thx in advance..... or can someone help fix my code so that i can then compare price with a + sign, or = sign or an int.....?
thx
ra2833
Last edited by alc6379; Nov 2nd, 2004 at 4:01 pm. Reason: added [code] tags
•
•
Join Date: Nov 2004
Posts: 7
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by oceanboy
Have you tried JOptionPane class
what i am looking for is something simple, that will recieve a string from the console or a function call.
for example in C++:
cout << "Please enter a number:" ;
cin >> number;
here, there is no dialog box's, just a simple request and simple recive.
thx
![]() |
Similar Threads
- Odd/Even Code (Java)
- Need help with Caesar Cipher program (Java)
- ShowInputDialog (Java)
- Need help with java prog (Java)
- calling methods. (Java)
- How do I read a line? (Java)
Other Threads in the Java Forum
- Previous Thread: help? trying to compare input with symbol.
- Next Thread: help? trying to compare input with symbol.
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card character class client code collision component crashcourse css csv database eclipse ee error fractal free game gis givemetehcodez graphics gui html ide image integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan machine map method methods migrate mobile netbeans newbie objects oriented output panel phone physics problem program programming project projects radio recursion replaydirector reporting researchinmotion scanner se server service set sms software sort sql string swing test textfield threads transfer tree trolltech ubuntu utility windows





