Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JFileChooser fc = new JFileChooser();
- int returnCode = fc.showSaveDialog(null);
- if (returnCode != JFileChooser.APPROVE_OPTION){
- System.exit(1);
- }
- FileReader fr= new FileReader(fc.getSelectedFile());
- BufferedReader br = new BufferedReader(fr);
- while (true) { //while true loop with a break
- int x;
- for(x=1;;x++){
- String aLine= br.readLine();
- if (aLine==null) break;
- System.out.println(x+":"+aLine);
- }
- }
- int saveCode = fc.showSaveDialog(null);
- if(saveCode == JFileChooser.APPROVE_OPTION);
- //System.exit(1);
- FileWriter fw = new FileWriter(fc.getSelectedFile());
- PrintWriter outputln = new PrintWriter(fw);
- BufferedReader br1 = new BufferedReader(fr);
- while (true) { // while true loop with a break
- //for(x=1;;x++){
- String aLine = br1.readLine();
- if (aLine == null)
- break;
- outputln.println(":"+aLine);
- }
- Random randomGenerator = new Random();
- for (int idx = 1; idx <= 1; ++idx){
- int randomInt = randomGenerator.nextInt(500);
- System.out.println("all done, copied: "+ fc.getDescription(null) );
- System.out.println("There are " + " lines and "+ " characters.");
- System.out.println("Here is a random number between 1 and 500: "+ randomInt);
- System.exit(0);
- }
- System.exit(1);
- }
- }
Add Comment
Please, Sign In to add comment