Normand Briere
2019-04-29 8c837a9e50c29e66bdf5bd7ea2fd15b1a7d5d598
GrafreeD.java
....@@ -50,7 +50,7 @@
5050 universe.material = new cMaterial();
5151 //god.addChild(universe);
5252 universe.name = "Applet";
53
- theApplet3D = this;
53
+ grafreeD = this;
5454 }
5555
5656 /**/
....@@ -595,29 +595,54 @@
595595
596596 public static void main(String argv[])
597597 {
598
- if (false) // argv.length == 0)
598
+ String osArch = System.getProperty("os.arch");
599
+ System.out.println("os.arch = " + osArch);
600
+
601
+ if (argv.length == 0)
599602 {
600
- String javaPath = System.getProperty("java.home") + "/bin/java";
603
+ String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
604
+ System.out.println("javaPath = " + javaPath);
601605 java.net.URL u = new GrafreeD().getClass().getResource("default.png");
602606
603
- System.out.println(u);
607
+ System.out.println("URL = " + u);
604608
605609 String jarfile = u.toString().split("file:")[1].split("default.png")[0];
606610
611
+ System.out.println("jarfile0 = " + jarfile);
612
+
607613 String jarpath = u.toString().split("file:")[1].split("GrafreeD.jar")[0];
608614
609
- System.out.println(jarfile);
610
- System.out.println(jarpath);
615
+ System.out.println("jarpath0 = " + jarpath);
611616
612617 jarfile = jarfile.substring(0, jarfile.length() - 2);
613618
614
- // -Djava.library.path=/Users/nbriere/Projects/shared/lib
619
+ System.out.println("jarfile = " + jarfile);
620
+
621
+ String command = javaPath + " -Xmx1024m -Djava.library.path=" + jarpath;
615622
616
- String command = "" + javaPath + " -Xmx1024m -Djava.library.path=" + jarpath + "lib -jar " + jarfile + " dummyarg";
623
+ // -Djava.library.path=/Users/nbriere/Projects/shared/lib
624
+ if (jarfile.charAt(2) == ':')
625
+ {
626
+ command = "\"" + javaPath + "\" -Xmx1024m -Djava.library.path=" + jarpath;
627
+ // On Windows systems, the path is /C:/
628
+ jarfile = jarfile.substring(1, jarfile.length());
629
+ System.out.println("jarfile = " + jarfile);
630
+ jarpath = jarpath.substring(1, jarpath.length());
631
+ System.out.println("jarpath = " + jarpath);
632
+ command += "native" + File.separator;
633
+ if (osArch.equals("amd64"))
634
+ command += "windows_amd64";
635
+ else
636
+ command += "windows_i586";
637
+ }
638
+ else
639
+ command += "native" + File.separator + "macosx";
640
+
641
+ command += " -jar " + jarfile + " dummyarg";
617642
618643 try
619644 {
620
- System.out.println(command);
645
+ System.out.println("command = " + command);
621646 Runtime.getRuntime().exec(command);
622647
623648 return;
....@@ -626,6 +651,44 @@
626651 {
627652 e.printStackTrace();
628653 }
654
+
655
+ /*
656
+ if (argv.length == 0)
657
+ {
658
+ String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
659
+ System.out.println("javaPath = " + javaPath);
660
+ java.net.URL u = new Grafeme().getClass().getResource("grafeme.jpg");
661
+ System.out.println("URL = " + u);
662
+
663
+ String jarfile = u.toString().split("file:")[1].split("grafeme/grafeme.jpg")[0];
664
+ System.out.println("jarfile0 = " + jarfile);
665
+
666
+ jarfile = jarfile.substring(0, jarfile.length() - 2); // Remove "!/" after .jar
667
+ System.out.println("jarfile = " + jarfile);
668
+
669
+ if (jarfile.charAt(2) == ':')
670
+ {
671
+ // On Windows systems, the path is /C:/
672
+ jarfile = jarfile.substring(1, jarfile.length());
673
+ System.out.println("jarfile = " + jarfile);
674
+ }
675
+
676
+ String command = "\"" + javaPath + "\" -Xmx1024m -jar " + jarfile + " dummyarg";
677
+
678
+ try
679
+ {
680
+ System.out.println(command);
681
+ Runtime.getRuntime().exec(command);
682
+
683
+ return;
684
+ }
685
+ catch (Exception e)
686
+ {
687
+ e.printStackTrace();
688
+ }
689
+ }
690
+
691
+ */
629692 }
630693
631694 // InitDictionary();
....@@ -742,24 +805,28 @@
742805 try
743806 {
744807 MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
745
- //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme));
808
+ MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme));
746809 UIManager.setLookAndFeel(new MetalLookAndFeel());
810
+ //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
811
+ //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
812
+ //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
747813 } catch (Exception e)
748814 {
749815 }
750816
751817 //Monitor mon=MonitorFactory.start("myFirstMonitor");
752818 standAlone = true;
753
- theApplet3D = new GrafreeD();
754
- theApplet3D.universe = new Composite();
755
- theApplet3D.universe.name = "Scene";
756
- theApplet3D.universe.material = new cMaterial();
819
+ grafreeD = new GrafreeD();
820
+ grafreeD.universe = new Composite();
821
+ grafreeD.universe.name = "Scene";
822
+ grafreeD.universe.material = new cMaterial();
757823 // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
758824
759
- theApplet3D.universe.root = true;
760
- theApplet3D.universe.openEditWindow(null, true); //, true);
825
+ grafreeD.universe.root = true;
826
+ grafreeD.universe.openEditWindow(null, true); //, true);
761827 //mon.stop();
762828 //System.out.println(mon);
829
+ //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
763830 }
764831
765832 // Timer callback
....@@ -984,7 +1051,7 @@
9841051 } while (avail > 0 && numRead >= 0);
9851052 return new String(data, 0, pos, "US-ASCII");
9861053 }
987
- public static GrafreeD theApplet3D;
1054
+ public static GrafreeD grafreeD;
9881055 public static boolean standAlone = true;
9891056 public Composite universe;
9901057 public static Object3D clipboard = new Object3D();