package app; import java.util.Scanner; import java.util.Timer; //import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import utils.ApplicationTime; import utils.FrameUpdate; public class _1_GeoAnimation_CreateAnimation { private static JFrame frame; public static void main(String[] args) { startmenu(); endmenu(); //open new thread for time measurement ApplicationTime animThread = new ApplicationTime(); animThread.start(); CreateFrame(animThread); Timer timer = new Timer(); timer.scheduleAtFixedRate(new FrameUpdate(frame), 100, _0_Constants.TPF); } public static void startmenu() { int select; Scanner scan = new Scanner(System.in); System.out.println("Start:"); System.out.println("1: Berlin"); System.out.println("2: Tokyo"); System.out.println("3: New York"); System.out.println("4: Kapstadt"); select = scan.nextInt(); switch(select) { case 1: _0_Constants.PHI_S = 52.52; //breite _0_Constants.THETA_S = 13.37; //Länge break; case 2: _0_Constants.PHI_S = 139.72; _0_Constants.THETA_S = 35.68; break; case 3: _0_Constants.PHI_S = -74.0; _0_Constants.THETA_S = 40.71; System.out.println("NY"); break; case 4: _0_Constants.PHI_S = 18.42; _0_Constants.THETA_S = -33.9; break; } } public static void endmenu() { int select; Scanner scanner = new Scanner(System.in); System.out.println("Das Ziel:"); System.out.println("1: Berlin"); System.out.println("2: Tokyo"); System.out.println("3: New York"); System.out.println("4: Kapstadt"); select = scanner.nextInt(); switch(select) { case 1: _0_Constants.PHI_E = 52.52; //breite _0_Constants.THETA_E = 13.37; //Länge break; case 2: _0_Constants.PHI_E = 139.72; _0_Constants.THETA_E = 35.68; break; case 3: _0_Constants.PHI_E = -74; _0_Constants.THETA_E = 40.71; break; case 4: _0_Constants.PHI_E = 18.42; _0_Constants.THETA_E = -33.9; break; } if(_0_Constants.PHI_E == _0_Constants.PHI_S && _0_Constants.THETA_E == _0_Constants.THETA_S) { System.out.println("Wieso solltest du zum selben Ort gehen wollen, an dem du eh schon bist???"); endmenu(); } } //create a JFrame as my container for the simulation content private static void CreateFrame(ApplicationTime thread) { //Create a new frame frame = new JFrame("Mathematik und Simulation"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add a JPanel as the new drawing surface JPanel panel = new _1_GeoAnimation_DrawingOperations(thread); frame.add(panel); frame.pack(); //adjusts size of the JFrame to fit the size of it's components frame.setVisible(true); // TODO Add other stuff // JButton button = new JButton("Click here!"); // frame.add(button); } }