Computer Science Canada Prompt |
Author: | SilverSprite [ Mon Jul 07, 2003 3:14 pm ] |
Post subject: | Prompt |
How do you create a prompt? |
Author: | rizzix [ Mon Jul 07, 2003 3:27 pm ] |
Post subject: | |
elaborate...? what do u mean? |
Author: | SilverSprite [ Mon Jul 07, 2003 3:43 pm ] |
Post subject: | |
i need to prompt the user to enter two integers.. how would i write a class to do that? |
Author: | bugzpodder [ Mon Jul 07, 2003 4:26 pm ] |
Post subject: | |
System.out.print would do |
Author: | Dan [ Mon Jul 07, 2003 5:46 pm ] |
Post subject: | |
int num = JOptionPane.showInputDialog("Enter an int"); |
Author: | SilverSprite [ Mon Jul 07, 2003 6:14 pm ] |
Post subject: | |
thx dan.. |
Author: | rizzix [ Mon Jul 07, 2003 6:15 pm ] |
Post subject: | |
heh but if u use dan's method.. then u need to import the javax.swing.* classes EDIT: woops typo... corrected it |
Author: | SilverSprite [ Mon Jul 07, 2003 6:30 pm ] |
Post subject: | |
Hacker Dan wrote: int num = JOptionPane.showInputDialog("Enter an int");
i get an incompatible types error.. |
Author: | rizzix [ Mon Jul 07, 2003 6:56 pm ] | ||
Post subject: | |||
it will return a string... the documentation says so. do this to conver teh string object to an int:
EDIT: based on bugzpodder recomendation.. which is the better way out.. |
Author: | bugzpodder [ Mon Jul 07, 2003 7:51 pm ] |
Post subject: | |
parseInt is the way to go. if you look on the hand out you'll see. |
Author: | rizzix [ Mon Jul 07, 2003 8:08 pm ] |
Post subject: | |
icic.. nice ![]() |
Author: | SilverSprite [ Mon Jul 07, 2003 9:09 pm ] |
Post subject: | |
oh.. thx all |
Author: | w0lv3rin3 [ Sat Sep 13, 2003 8:59 pm ] | ||
Post subject: | |||
Small example
|
Author: | rizzix [ Sun Sep 14, 2003 10:57 am ] |
Post subject: | |
w0lv3rin3, thats JavaScript not Java. Thanks anyways. |
Author: | w0lv3rin3 [ Sun Sep 14, 2003 11:31 am ] |
Post subject: | |
r you kidding me, ur a biggest newb, THAT IS JAVA that code i just posted. omfg, im in college right now, and my professor just taught me that code, for a beginner code. |
Author: | rizzix [ Sun Sep 14, 2003 11:41 am ] |
Post subject: | |
what packages do you need to import? That code does not look like any familiar code to me. based on the following i presumed it was javascript. you variables are not declared but directly defined. screen.write(""); is something i'm sure java does not have. anyways.. you might be using what is known as bsh or the bean shell. i don't know much of the bean shell syntax. but it's supposed to be the Java scripting language. Technically any valid java code is a valid beanshell code. but not the other way round. but if it is java that code won't compile. (as i said what packages do i need to import?) |
Author: | w0lv3rin3 [ Sun Sep 14, 2003 2:16 pm ] | ||||
Post subject: | |||||
here is full code from a program I was pratcing on: packages needed are avi.*
|
Author: | rizzix [ Sun Sep 14, 2003 9:20 pm ] |
Post subject: | |
o ok.. ur using non-standard packages.. ur ehm.. college provides. thats cool. although you can learn java with the standard packages. |
Author: | nate [ Mon Sep 15, 2003 9:48 pm ] |
Post subject: | |
for a college student you sure don't know your grammar. Quote: ur a biggest newb |
Author: | Tony [ Mon Sep 15, 2003 9:59 pm ] |
Post subject: | |
yeah... there should be a rule that when you post java code that implements non standart packages, please include all the "include..." lines so the rest of us wouldn't have to guess ![]() maybe rizzix should write it up, he knows Java better then I do |
Author: | rizzix [ Wed Sep 17, 2003 4:27 pm ] |
Post subject: | |
yea i'd agree tony. there are far too many java-like scripting variants that look similar to java. it get's pretty confusing at times. I mean java code is 100% bean shell compatible yet not the other way round (i.e bsh code is not 100% java compatible). speaking of which do check out this awsome scripting language @ www.beanshell.org .. and don't be to hard on that dude, he probably got offended for some reason ![]() |