The Artima Developer Community
Sponsored Link

Java Answers Forum
I need everubody help immediately ...

2 replies on 1 page. Most recent reply: May 10, 2003 8:26 PM by Salman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Salman

Posts: 3
Nickname: sal
Registered: May, 2003

I need everubody help immediately ... Posted: May 10, 2003 7:52 AM
Reply to this message Reply
Advertisement
I am to have exams in one day time ... it is urgent .. any help u guys could give would be appreciated ... have to study this program...

Create a simple text editor just like copy con dos command

Java CopyCon abc.txt
This is simple text file
This is the second line
stop

"stop" command will save and create the file.

Now guys everybody ... plz help me out.


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: I need everubody help immediately ... Posted: May 10, 2003 8:10 AM
Reply to this message Reply
import java.io.*;
/** CopyCon.java
*/
public class CopyCon{
 
    public CopyCon(String fileName){
        try{
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            FileWriter fw = new FileWriter(fileName);
            String lineRead = "";
            while (!(lineRead = br.readLine()).equals("stop")){
                fw.write(lineRead + "\n");
            }
            fw.close();        
        }catch(IOException ioe){
            System.err.println("IOException: " + ioe.getMessage());
        }
    }
    
    public static void main(String[] args){
        if (args.length != 1){
            System.err.println("Useage: java CopyCon fileName");
        }else{
            new CopyCon(args[0]);
        }
    }
}

Salman

Posts: 3
Nickname: sal
Registered: May, 2003

Charles I need you help again immediately ... Posted: May 10, 2003 8:26 PM
Reply to this message Reply
Thank u charles... u r a life saver .... One more favor ... can u post programs on database connectivity as well ... in which we can insert text fields from swing Jtextfields to database when we press save Jbutton ... and also for retrieving text into swing Jtextfields from the database.
I also need to see a program in which we can save swing Jtextfield to a file ... and vice versa in which we can retrieve data into Jtextfields from the file. Thanks for your attention. Hoping for your positive response as soon as possible. Bye

Flat View: This topic has 2 replies on 1 page
Topic: HELP!how to apply J2EE to crystal report??? Previous Topic   Next Topic Topic: Trouble with a jar file

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use