|Oct 25, 2007, 09:26 PM||#1|
can someone help me with my java assignment please?
i'm really lost. i'm supposed to write a program that gets input from dialog boxes and then produces the output to a file. suppose the input was asking for your name. can someone help me please? the homework is more complex then that but that will help me figure it out after that. thanks.
|Oct 25, 2007, 10:23 PM||#2|
i've never worked with dialog boxes in java, just command line or from a file. But i assume that the spaces in a dialog box are assigned to variables, so when you enter a name, it is stored in a variable, or maybe a variable array. though I may be very wrong.
Once you find out how to get the input, writing to a file is pretty easy.
First you will need to use the FileWriter class. Depending on what version of java you are using, this sight is very helpful http://java.sun.com/j2se/1.5.0/docs/api/
for writing to a file, do something like this.
PrintWriter fout = new PrintWriter(new FileWriter("filename"));
fout.println("Whatever you want " + your_data + " you get the idea");
DONT FORGET THAT LAST LINE! If you don't close the file, it will be empty when you try to open it, and it is frustrating to figure out what's wrong, until you finally realize you never close it. I hope that helps some
Do you know what class you are using for the dialog box?? is it JOptionPane? or something different?
20" iMac 2.16 C2D, 2GB RAM, 500GB HD, 256MB X1600
|Oct 26, 2007, 12:14 AM||#3|
Are you looking for standalone application like think or webpage like.
If you are going for standalone application looking for help in AWT or Swings.
For Webpage, servelets and JSP are there.
Pick the proper one as per ur requirements.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Some apps prompt to install Java 6 even when Java 7 is installed||MacMan988||OS X Mavericks (10.9)||1||Apr 18, 2014 07:56 AM|
|Java 6 or Java 7 for OSX Mavericks for your Macbook Pro?||Starfyre||MacBook Pro||3||Dec 22, 2013 03:49 PM|
|Java 6.x security risk (?) vs Java 7.x and broken apps w/ v7.x installs?||mgiamo||Mac Basics and Help||1||Dec 15, 2013 03:48 PM|
|Chrome on OS X -- Java plugin / Java 7 vs Java 6 Issue||booyahbooyah||Mac Applications and Mac App Store||4||May 31, 2013 09:13 AM|
|Installed Java 7.07 but doesn't show up in Java preferences?||-mattias-||OS X 10.8 Mountain Lion||21||Aug 31, 2012 04:49 PM|
All times are GMT -5. The time now is 05:14 AM.