.. | .. |
---|
15 | 15 | //import com.jamonapi.*; |
---|
16 | 16 | public class GrafreeD extends Applet implements ActionListener |
---|
17 | 17 | { |
---|
| 18 | + static boolean NIMBUSLAF = true; |
---|
| 19 | + |
---|
18 | 20 | static int RENDERME = 0; |
---|
19 | 21 | |
---|
20 | 22 | static boolean epsequal = false; |
---|
.. | .. |
---|
595 | 597 | |
---|
596 | 598 | public static void main(String argv[]) |
---|
597 | 599 | { |
---|
598 | | - if (false) // argv.length == 0) |
---|
| 600 | + String osArch = System.getProperty("os.arch"); |
---|
| 601 | + System.out.println("os.arch = " + osArch); |
---|
| 602 | + |
---|
| 603 | + if (argv.length == 0) |
---|
599 | 604 | { |
---|
600 | | - String javaPath = System.getProperty("java.home") + "/bin/java"; |
---|
| 605 | + String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; |
---|
| 606 | + System.out.println("javaPath = " + javaPath); |
---|
601 | 607 | java.net.URL u = new GrafreeD().getClass().getResource("default.png"); |
---|
602 | 608 | |
---|
603 | | - System.out.println(u); |
---|
| 609 | + System.out.println("URL = " + u); |
---|
604 | 610 | |
---|
605 | 611 | String jarfile = u.toString().split("file:")[1].split("default.png")[0]; |
---|
606 | 612 | |
---|
| 613 | + System.out.println("jarfile0 = " + jarfile); |
---|
| 614 | + |
---|
607 | 615 | String jarpath = u.toString().split("file:")[1].split("GrafreeD.jar")[0]; |
---|
608 | 616 | |
---|
609 | | - System.out.println(jarfile); |
---|
610 | | - System.out.println(jarpath); |
---|
| 617 | + System.out.println("jarpath0 = " + jarpath); |
---|
611 | 618 | |
---|
612 | 619 | jarfile = jarfile.substring(0, jarfile.length() - 2); |
---|
613 | 620 | |
---|
614 | | - // -Djava.library.path=/Users/nbriere/Projects/shared/lib |
---|
| 621 | + System.out.println("jarfile = " + jarfile); |
---|
| 622 | + |
---|
| 623 | + String command = javaPath + " -Xmx1024m -Djava.library.path=" + jarpath; |
---|
615 | 624 | |
---|
616 | | - String command = "" + javaPath + " -Xmx1024m -Djava.library.path=" + jarpath + "lib -jar " + jarfile + " dummyarg"; |
---|
| 625 | + // -Djava.library.path=/Users/nbriere/Projects/shared/lib |
---|
| 626 | + if (jarfile.charAt(2) == ':') |
---|
| 627 | + { |
---|
| 628 | + command = "\"" + javaPath + "\" -Xmx1024m -Djava.library.path=" + jarpath; |
---|
| 629 | + // On Windows systems, the path is /C:/ |
---|
| 630 | + jarfile = jarfile.substring(1, jarfile.length()); |
---|
| 631 | + System.out.println("jarfile = " + jarfile); |
---|
| 632 | + jarpath = jarpath.substring(1, jarpath.length()); |
---|
| 633 | + System.out.println("jarpath = " + jarpath); |
---|
| 634 | + command += "native" + File.separator; |
---|
| 635 | + if (osArch.equals("amd64")) |
---|
| 636 | + command += "windows_amd64"; |
---|
| 637 | + else |
---|
| 638 | + command += "windows_i586"; |
---|
| 639 | + } |
---|
| 640 | + else |
---|
| 641 | + command += "native" + File.separator + "macosx"; |
---|
| 642 | + |
---|
| 643 | + command += " -jar " + jarfile + " dummyarg"; |
---|
617 | 644 | |
---|
618 | 645 | try |
---|
619 | 646 | { |
---|
620 | | - System.out.println(command); |
---|
| 647 | + System.out.println("command = " + command); |
---|
621 | 648 | Runtime.getRuntime().exec(command); |
---|
622 | 649 | |
---|
623 | 650 | return; |
---|
.. | .. |
---|
626 | 653 | { |
---|
627 | 654 | e.printStackTrace(); |
---|
628 | 655 | } |
---|
| 656 | + |
---|
| 657 | + /* |
---|
| 658 | + if (argv.length == 0) |
---|
| 659 | + { |
---|
| 660 | + String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; |
---|
| 661 | + System.out.println("javaPath = " + javaPath); |
---|
| 662 | + java.net.URL u = new Grafeme().getClass().getResource("grafeme.jpg"); |
---|
| 663 | + System.out.println("URL = " + u); |
---|
| 664 | + |
---|
| 665 | + String jarfile = u.toString().split("file:")[1].split("grafeme/grafeme.jpg")[0]; |
---|
| 666 | + System.out.println("jarfile0 = " + jarfile); |
---|
| 667 | + |
---|
| 668 | + jarfile = jarfile.substring(0, jarfile.length() - 2); // Remove "!/" after .jar |
---|
| 669 | + System.out.println("jarfile = " + jarfile); |
---|
| 670 | + |
---|
| 671 | + if (jarfile.charAt(2) == ':') |
---|
| 672 | + { |
---|
| 673 | + // On Windows systems, the path is /C:/ |
---|
| 674 | + jarfile = jarfile.substring(1, jarfile.length()); |
---|
| 675 | + System.out.println("jarfile = " + jarfile); |
---|
| 676 | + } |
---|
| 677 | + |
---|
| 678 | + String command = "\"" + javaPath + "\" -Xmx1024m -jar " + jarfile + " dummyarg"; |
---|
| 679 | + |
---|
| 680 | + try |
---|
| 681 | + { |
---|
| 682 | + System.out.println(command); |
---|
| 683 | + Runtime.getRuntime().exec(command); |
---|
| 684 | + |
---|
| 685 | + return; |
---|
| 686 | + } |
---|
| 687 | + catch (Exception e) |
---|
| 688 | + { |
---|
| 689 | + e.printStackTrace(); |
---|
| 690 | + } |
---|
| 691 | + } |
---|
| 692 | + |
---|
| 693 | + */ |
---|
629 | 694 | } |
---|
630 | 695 | |
---|
631 | 696 | // InitDictionary(); |
---|
.. | .. |
---|
738 | 803 | // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1); |
---|
739 | 804 | |
---|
740 | 805 | |
---|
741 | | - |
---|
742 | | - try |
---|
| 806 | +/**/ |
---|
| 807 | + if (NIMBUSLAF) |
---|
743 | 808 | { |
---|
744 | | - MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); |
---|
745 | | - MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); |
---|
746 | | - UIManager.setLookAndFeel(new MetalLookAndFeel()); |
---|
747 | | - //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
| 809 | + try |
---|
| 810 | + { |
---|
| 811 | + Object o = UIManager.getInstalledLookAndFeels(); |
---|
| 812 | + |
---|
| 813 | + javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); |
---|
| 814 | + //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); |
---|
| 815 | + UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); |
---|
| 816 | + |
---|
| 817 | + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
748 | 818 | //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
749 | 819 | //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
---|
750 | | - } catch (Exception e) |
---|
751 | | - { |
---|
| 820 | + //UIManager.put("nimbusBase", new Color(0,0,0)); |
---|
| 821 | + } |
---|
| 822 | + catch (Exception e) |
---|
| 823 | + { |
---|
| 824 | + } |
---|
752 | 825 | } |
---|
| 826 | + else |
---|
| 827 | + { |
---|
| 828 | + try |
---|
| 829 | + { |
---|
| 830 | + MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); |
---|
| 831 | + MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); |
---|
| 832 | + UIManager.setLookAndFeel(new MetalLookAndFeel()); |
---|
| 833 | + //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
| 834 | + //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
| 835 | + //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
---|
| 836 | + } catch (Exception e) |
---|
| 837 | + { |
---|
| 838 | + } |
---|
| 839 | + } |
---|
| 840 | +/**/ |
---|
753 | 841 | |
---|
| 842 | +// javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 843 | + |
---|
754 | 844 | //Monitor mon=MonitorFactory.start("myFirstMonitor"); |
---|
755 | 845 | standAlone = true; |
---|
756 | 846 | grafreeD = new GrafreeD(); |
---|