Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Oct 25, 2007, 09:26 PM   #1
macrumors regular
Join Date: Oct 2006
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.
apattee is offline   0 Reply With Quote
Old Oct 25, 2007, 10:23 PM   #2
macrumors 6502
Join Date: Sep 2007
Location: Seattle, WA
Send a message via MSN to hankolerd
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
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
hankolerd is offline   0 Reply With Quote
Old Oct 26, 2007, 12:14 AM   #3
macrumors regular
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
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.
satyam90 is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Please someone help me with my dilemma.. botchok5 MacBook Pro 6 Sep 6, 2010 12:10 PM
Can someone help me with my dock situation pleasssssse? gnownayr OS X 1 Nov 14, 2007 07:33 PM
Can someone help me with my Mini? MAC1988 Mac mini 5 Jun 14, 2007 11:00 PM
Can someone help me with my Flash movie? Mike Teezie Web Design and Development (archive) 2 Jan 9, 2004 04:09 PM

All times are GMT -5. The time now is 12:54 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC