From c209bbe1cf788c9af3dcffea7667c830170a3f1f Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 01 May 2019 20:30:51 -0400 Subject: [PATCH] Complete advanced mode. --- GrafreeD.java | 138 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 116 insertions(+), 22 deletions(-) diff --git a/GrafreeD.java b/GrafreeD.java index bc4d7f1..d82d57e 100644 --- a/GrafreeD.java +++ b/GrafreeD.java @@ -15,6 +15,8 @@ //import com.jamonapi.*; public class GrafreeD extends Applet implements ActionListener { + static boolean NIMBUSLAF = true; + static int RENDERME = 0; static boolean epsequal = false; @@ -50,7 +52,7 @@ universe.material = new cMaterial(); //god.addChild(universe); universe.name = "Applet"; - theApplet3D = this; + grafreeD = this; } /**/ @@ -595,29 +597,54 @@ public static void main(String argv[]) { + String osArch = System.getProperty("os.arch"); + System.out.println("os.arch = " + osArch); + if (argv.length == 0) { - String javaPath = System.getProperty("java.home") + "/bin/java"; + String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; + System.out.println("javaPath = " + javaPath); java.net.URL u = new GrafreeD().getClass().getResource("default.png"); - System.out.println(u); + System.out.println("URL = " + u); String jarfile = u.toString().split("file:")[1].split("default.png")[0]; + System.out.println("jarfile0 = " + jarfile); + String jarpath = u.toString().split("file:")[1].split("GrafreeD.jar")[0]; - System.out.println(jarfile); - System.out.println(jarpath); + System.out.println("jarpath0 = " + jarpath); jarfile = jarfile.substring(0, jarfile.length() - 2); - // -Djava.library.path=/Users/nbriere/Projects/shared/lib + System.out.println("jarfile = " + jarfile); + + String command = javaPath + " -Xmx1024m -Djava.library.path=" + jarpath; - String command = "" + javaPath + " -Xmx1024m -Djava.library.path=" + jarpath + "lib -jar " + jarfile + " dummyarg"; + // -Djava.library.path=/Users/nbriere/Projects/shared/lib + if (jarfile.charAt(2) == ':') + { + command = "\"" + javaPath + "\" -Xmx1024m -Djava.library.path=" + jarpath; + // On Windows systems, the path is /C:/ + jarfile = jarfile.substring(1, jarfile.length()); + System.out.println("jarfile = " + jarfile); + jarpath = jarpath.substring(1, jarpath.length()); + System.out.println("jarpath = " + jarpath); + command += "native" + File.separator; + if (osArch.equals("amd64")) + command += "windows_amd64"; + else + command += "windows_i586"; + } + else + command += "native" + File.separator + "macosx"; + + command += " -jar " + jarfile + " dummyarg"; try { - System.out.println(command); + System.out.println("command = " + command); Runtime.getRuntime().exec(command); return; @@ -626,6 +653,44 @@ { e.printStackTrace(); } + + /* + if (argv.length == 0) + { + String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; + System.out.println("javaPath = " + javaPath); + java.net.URL u = new Grafeme().getClass().getResource("grafeme.jpg"); + System.out.println("URL = " + u); + + String jarfile = u.toString().split("file:")[1].split("grafeme/grafeme.jpg")[0]; + System.out.println("jarfile0 = " + jarfile); + + jarfile = jarfile.substring(0, jarfile.length() - 2); // Remove "!/" after .jar + System.out.println("jarfile = " + jarfile); + + if (jarfile.charAt(2) == ':') + { + // On Windows systems, the path is /C:/ + jarfile = jarfile.substring(1, jarfile.length()); + System.out.println("jarfile = " + jarfile); + } + + String command = "\"" + javaPath + "\" -Xmx1024m -jar " + jarfile + " dummyarg"; + + try + { + System.out.println(command); + Runtime.getRuntime().exec(command); + + return; + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + */ } // InitDictionary(); @@ -738,28 +803,57 @@ // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1); - - try +/**/ + if (NIMBUSLAF) { - MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); - //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); - UIManager.setLookAndFeel(new MetalLookAndFeel()); - } catch (Exception e) - { + try + { + Object o = UIManager.getInstalledLookAndFeels(); + + javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); + //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); + UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); + + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); + //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); + //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + //UIManager.put("nimbusBase", new Color(0,0,0)); + } + catch (Exception e) + { + } } + else + { + try + { + MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); + MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); + UIManager.setLookAndFeel(new MetalLookAndFeel()); + //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); + //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); + //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception e) + { + } + } +/**/ +// javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); + //Monitor mon=MonitorFactory.start("myFirstMonitor"); standAlone = true; - theApplet3D = new GrafreeD(); - theApplet3D.universe = new Composite(); - theApplet3D.universe.name = "Scene"; - theApplet3D.universe.material = new cMaterial(); + grafreeD = new GrafreeD(); + grafreeD.universe = new Composite(); + grafreeD.universe.name = "Scene"; + grafreeD.universe.material = new cMaterial(); // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE; - theApplet3D.universe.root = true; - theApplet3D.universe.openEditWindow(null, true); //, true); + grafreeD.universe.root = true; + grafreeD.universe.openEditWindow(null, true); //, true); //mon.stop(); //System.out.println(mon); + //timeflow.app.TimeflowAppLauncher.GetTimeFlow(); } // Timer callback @@ -984,7 +1078,7 @@ } while (avail > 0 && numRead >= 0); return new String(data, 0, pos, "US-ASCII"); } - public static GrafreeD theApplet3D; + public static GrafreeD grafreeD; public static boolean standAlone = true; public Composite universe; public static Object3D clipboard = new Object3D(); -- Gitblit v1.6.2