Rabu, 13 November 2013
Drawing, Save and Load Data
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Faridl
*/
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
SaveCoordinat simpan = new SaveCoordinat();
System.out.println("================MainMenu====================");
System.out.println("=============Choose Your Number=============");
System.out.println("1. Drawing");
System.out.println("2. Save Coordinat");
System.out.println("3. Re-Load Coordinat");
System.out.println("4. Exit");
System.out.println("********************************************");
int Select = input.nextInt();
switch(Select){
case 1:
Drawing opened = new Drawing();
opened.Draw();
break;
case 2: try {
simpan.simpanFileBaru();
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("\n");
break;
case 3:
System.out.println("Enter your File Location and Extention");
String namaFile = input.next();
try {
FileReader br = new FileReader(namaFile);
Scanner sc=new Scanner(br);
Drawing lihat = new Drawing();
lihat.Draw();
} catch (FileNotFoundException ex) {
System.out.println("File not Found");
}break;
case 4:
System.out.println("Thank you");
System.exit(0);
}
}
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar