.. | .. |
---|
13 | 13 | |
---|
14 | 14 | import javax.sound.sampled.*; |
---|
15 | 15 | |
---|
| 16 | +import javax.net.ssl.HostnameVerifier; |
---|
| 17 | +import javax.net.ssl.HttpsURLConnection; |
---|
| 18 | +import javax.net.ssl.SSLContext; |
---|
| 19 | +import javax.net.ssl.SSLSession; |
---|
| 20 | +import javax.net.ssl.TrustManager; |
---|
| 21 | +import javax.net.ssl.X509TrustManager; |
---|
| 22 | + |
---|
| 23 | +import java.security.cert.X509Certificate; |
---|
| 24 | +import java.net.Authenticator; |
---|
| 25 | +import java.net.PasswordAuthentication; |
---|
| 26 | + |
---|
16 | 27 | //import com.jamonapi.*; |
---|
17 | 28 | public class Grafreed extends Applet implements ActionListener |
---|
18 | | -{ |
---|
19 | | - static boolean NIMBUSLAF = false; // true; |
---|
20 | | - |
---|
| 29 | +{ |
---|
21 | 30 | static int RENDERME = 0; |
---|
22 | 31 | |
---|
23 | 32 | static boolean epsequal = false; |
---|
.. | .. |
---|
675 | 684 | PlayWord(word, 1); |
---|
676 | 685 | } |
---|
677 | 686 | |
---|
| 687 | + static boolean isWindows; |
---|
| 688 | + |
---|
678 | 689 | public static void main(String argv[]) |
---|
679 | 690 | { |
---|
680 | | - String osArch = System.getProperty("os.arch"); |
---|
| 691 | + String osArch = System.getProperty("os.arch"); |
---|
681 | 692 | if (Globals.DEBUG) |
---|
682 | 693 | System.out.println("os.arch = " + osArch); |
---|
683 | 694 | |
---|
| 695 | + String osName = System.getProperty("os.name"); |
---|
| 696 | + |
---|
| 697 | + isWindows = !osName.equals("Mac OS X"); |
---|
| 698 | + |
---|
684 | 699 | if (argv.length == 0) |
---|
685 | 700 | { |
---|
686 | 701 | String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; |
---|
.. | .. |
---|
883 | 898 | // try{Thread.sleep(5000);}catch(Exception e){} |
---|
884 | 899 | // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1); |
---|
885 | 900 | |
---|
886 | | - |
---|
887 | 901 | /**/ |
---|
888 | | - if (NIMBUSLAF) |
---|
| 902 | + if (Globals.NIMBUSLAF) |
---|
889 | 903 | { |
---|
890 | 904 | try |
---|
891 | 905 | { |
---|
892 | | - Object o = UIManager.getInstalledLookAndFeels(); |
---|
| 906 | + //Object o = UIManager.getInstalledLookAndFeels(); |
---|
893 | 907 | |
---|
894 | 908 | javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); |
---|
895 | 909 | //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); |
---|
896 | | - UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); |
---|
| 910 | + //UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); |
---|
897 | 911 | |
---|
898 | 912 | UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
899 | 913 | //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
.. | .. |
---|
901 | 915 | //UIManager.put("nimbusBase", new Color(0,0,0)); |
---|
902 | 916 | |
---|
903 | 917 | javax.swing.UIDefaults ui = UIManager.getDefaults(); |
---|
| 918 | + |
---|
| 919 | + ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0)); |
---|
| 920 | + |
---|
904 | 921 | for (java.util.Enumeration e = ui.keys(); e.hasMoreElements();) |
---|
905 | 922 | { |
---|
906 | 923 | Object key = e.nextElement(); |
---|
.. | .. |
---|
920 | 937 | MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); |
---|
921 | 938 | //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); |
---|
922 | 939 | //UIManager.put("ScrollBar.background", new javax.swing.plaf.ColorUIResource(100,0,0)); |
---|
| 940 | + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
| 941 | + |
---|
| 942 | + javax.swing.UIDefaults ui = UIManager.getDefaults(); |
---|
| 943 | + |
---|
| 944 | + Object x = ui.get("TabbedPane.background"); |
---|
| 945 | + |
---|
923 | 946 | UIManager.setLookAndFeel(new MetalLookAndFeel()); |
---|
924 | | - //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
925 | 947 | //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
926 | 948 | //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
927 | 949 | //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
---|
928 | 950 | |
---|
929 | | - javax.swing.UIDefaults ui = UIManager.getDefaults(); |
---|
| 951 | + ui = UIManager.getDefaults(); |
---|
| 952 | + |
---|
| 953 | + x = ui.get("RadioButton.icon"); |
---|
| 954 | + |
---|
930 | 955 | ArrayList gradient = new java.util.ArrayList(5); |
---|
931 | 956 | gradient.add(1.0); |
---|
932 | 957 | gradient.add(0.0); |
---|
.. | .. |
---|
935 | 960 | gradient.add(new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
936 | 961 | |
---|
937 | 962 | ui.put("Button.gradient", gradient); |
---|
938 | | - ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0)); |
---|
| 963 | + |
---|
| 964 | + //ui.put("RadioButton.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); |
---|
| 965 | + ui.put("CheckBox.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); |
---|
| 966 | + //ui.put("CheckBoxMenuItem.checkIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); |
---|
| 967 | + |
---|
939 | 968 | ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
940 | 969 | ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); |
---|
941 | 970 | |
---|
| 971 | + /* |
---|
| 972 | +TabbedPane.unselectedBackground Color |
---|
| 973 | +TabbedPane.unselectedTabBackground Color |
---|
| 974 | +TabbedPane.unselectedTabForeground Color |
---|
| 975 | +TabbedPane.unselectedTabHighlight Color |
---|
| 976 | +TabbedPane.unselectedTabShadow |
---|
| 977 | + */ |
---|
| 978 | +// ui.put("TabbedPane.contentAreaColor", new javax.swing.plaf.ColorUIResource(0,100,0)); |
---|
| 979 | + //ui.put("TabbedPane.selected", new javax.swing.plaf.ColorUIResource(200,0,200)); |
---|
| 980 | + |
---|
| 981 | + ui.put("TabbedPane.background", new javax.swing.plaf.ColorUIResource(150,150,150)); |
---|
| 982 | + ui.put("TabbedPane.foreground", new javax.swing.plaf.ColorUIResource(50,50,50)); |
---|
| 983 | + ui.put("TabbedPane.light", new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 984 | + ui.put("TabbedPane.selectedForeground", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 985 | + ui.put("TabbedPane.selectHighlight", new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 986 | + ui.put("TabbedPane.darkShadow", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 987 | + |
---|
| 988 | +// ui.put("TabbedPane.shadow", new javax.swing.plaf.ColorUIResource(200,0,0)); |
---|
| 989 | +// ui.put("TabbedPane.tabAreaBackground", new javax.swing.plaf.ColorUIResource(0,200,0)); |
---|
| 990 | +// ui.put("TabbedPane.unselectedBackground", new javax.swing.plaf.ColorUIResource(200,200,0)); |
---|
| 991 | +// ui.put("TabbedPane.unselectedTabBackground", new javax.swing.plaf.ColorUIResource(0,0,200)); |
---|
| 992 | +// ui.put("TabbedPane.unselectedTabForeground", new javax.swing.plaf.ColorUIResource(200,0,200)); |
---|
| 993 | +// ui.put("TabbedPane.unselectedTabHighlight", new javax.swing.plaf.ColorUIResource(0,200,200)); |
---|
| 994 | +// ui.put("TabbedPane.unselectedTabShadow", new javax.swing.plaf.ColorUIResource(200,200,200)); |
---|
| 995 | + |
---|
| 996 | + ui.put("TabbedPane.textIconGap", 0); |
---|
| 997 | + ui.put("TabbedPane.contentBorderInsets", new javax.swing.plaf.InsetsUIResource(0,0,0,0)); |
---|
| 998 | + ui.put("TabbedPane.tabAreaInsets", new javax.swing.plaf.InsetsUIResource(1,1,0,0)); |
---|
| 999 | + ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0)); |
---|
| 1000 | + |
---|
| 1001 | + Object openIcon2 = ui.get("Tree.openIcon"); |
---|
| 1002 | + |
---|
| 1003 | + ui.put("Tree.openIcon", ObjEditor.GetIcon("icons/folderopen.png")); |
---|
| 1004 | + ui.put("Tree.closedIcon", ObjEditor.GetIcon("icons/folderclose.png")); |
---|
| 1005 | + ui.put("Tree.leafIcon", ObjEditor.GetIcon("icons/file.png")); |
---|
| 1006 | + |
---|
942 | 1007 | //javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon(). |
---|
943 | 1008 | Object o = ui.get("Slider.horizontalThumbIcon"); |
---|
944 | 1009 | |
---|
.. | .. |
---|
963 | 1028 | } |
---|
964 | 1029 | } |
---|
965 | 1030 | /**/ |
---|
| 1031 | + |
---|
| 1032 | + // Create a trust manager that does not validate certificate chains |
---|
| 1033 | + final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { |
---|
| 1034 | + @Override |
---|
| 1035 | + public void checkClientTrusted(final X509Certificate[] chain, final String authType) { |
---|
| 1036 | + } |
---|
| 1037 | + |
---|
| 1038 | + @Override |
---|
| 1039 | + public void checkServerTrusted(final X509Certificate[] chain, final String authType) { |
---|
| 1040 | + } |
---|
| 1041 | + |
---|
| 1042 | + @Override |
---|
| 1043 | + public X509Certificate[] getAcceptedIssuers() { |
---|
| 1044 | + return null; |
---|
| 1045 | + } |
---|
| 1046 | + } }; |
---|
| 1047 | + |
---|
| 1048 | + try |
---|
| 1049 | + { |
---|
| 1050 | + // Install the all-trusting trust manager |
---|
| 1051 | + final SSLContext sslContext = SSLContext.getInstance("SSL"); |
---|
| 1052 | + sslContext.init(null, trustAllCerts, null); |
---|
| 1053 | + // Create an ssl socket factory with our all-trusting manager |
---|
| 1054 | + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); |
---|
| 1055 | + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { |
---|
| 1056 | + public boolean verify(String urlHostName, SSLSession session) { |
---|
| 1057 | + return true; |
---|
| 1058 | + } |
---|
| 1059 | + }); |
---|
| 1060 | + // be authentic |
---|
| 1061 | + Authenticator.setDefault(new Authenticator() { |
---|
| 1062 | + @Override |
---|
| 1063 | + protected PasswordAuthentication getPasswordAuthentication() { |
---|
| 1064 | + return new PasswordAuthentication("args[0]", "args[1]".toCharArray()); |
---|
| 1065 | + } |
---|
| 1066 | + }); |
---|
| 1067 | + } |
---|
| 1068 | + catch (Exception e) |
---|
| 1069 | + { |
---|
| 1070 | + e.printStackTrace(); |
---|
| 1071 | + } |
---|
| 1072 | + |
---|
| 1073 | + |
---|
| 1074 | + ///////////// |
---|
966 | 1075 | |
---|
967 | 1076 | // javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
968 | 1077 | |
---|
969 | 1078 | //Monitor mon=MonitorFactory.start("myFirstMonitor"); |
---|
970 | 1079 | standAlone = true; |
---|
971 | | - grafreed = new Grafreed(); |
---|
| 1080 | + |
---|
| 1081 | + grafreed = new Grafreed(); |
---|
| 1082 | + |
---|
972 | 1083 | grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd")); |
---|
973 | 1084 | |
---|
974 | 1085 | grafreed.universe = new cGroup(); |
---|
975 | 1086 | grafreed.universe.name = "Grafreed"; |
---|
976 | 1087 | grafreed.universe.material = new cMaterial(); |
---|
977 | | - grafreed.universe.skyboxname = "cubemaps/penguins-skyboxes/yonder"; |
---|
978 | | - grafreed.universe.skyboxext = "jpg"; |
---|
979 | 1088 | |
---|
980 | 1089 | // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE; |
---|
981 | 1090 | |
---|
982 | 1091 | grafreed.universe.root = true; |
---|
983 | 1092 | grafreed.universe.openEditWindow(null, true); //, true); |
---|
| 1093 | + grafreed.universe.editWindow.New(); |
---|
| 1094 | + |
---|
984 | 1095 | //mon.stop(); |
---|
985 | 1096 | //System.out.println(mon); |
---|
986 | 1097 | //timeflow.app.TimeflowAppLauncher.GetTimeFlow(); |
---|
.. | .. |
---|
988 | 1099 | javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS); |
---|
989 | 1100 | } |
---|
990 | 1101 | |
---|
| 1102 | + static class CheckBox extends javax.swing.plaf.metal.MetalCheckBoxIcon |
---|
| 1103 | + { |
---|
| 1104 | + java.awt.image.BufferedImage image; |
---|
| 1105 | + |
---|
| 1106 | + CheckBox() |
---|
| 1107 | + { |
---|
| 1108 | + try |
---|
| 1109 | + { |
---|
| 1110 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream("icons/checkbox.png")); |
---|
| 1111 | + } |
---|
| 1112 | + catch (Exception e) |
---|
| 1113 | + { |
---|
| 1114 | + } |
---|
| 1115 | + } |
---|
| 1116 | + |
---|
| 1117 | + protected void drawCheck(Component c, Graphics g, int x, int y) |
---|
| 1118 | + { |
---|
| 1119 | + super.drawCheck(c, g, x, y); |
---|
| 1120 | + } |
---|
| 1121 | + |
---|
| 1122 | + public void paintIcon(Component c, Graphics g, int x, int y) |
---|
| 1123 | + { |
---|
| 1124 | + g.drawImage(image, x-1, y-1, 19, 19, null); |
---|
| 1125 | + super.paintIcon(c, g, x+2, y+2); |
---|
| 1126 | + } |
---|
| 1127 | + } |
---|
| 1128 | + |
---|
991 | 1129 | static Object3D materials; |
---|
992 | 1130 | |
---|
993 | 1131 | static Object3D ReadGFD(java.io.InputStream istream) |
---|
.. | .. |
---|
1150 | 1288 | |
---|
1151 | 1289 | static public Object clone(Object o) |
---|
1152 | 1290 | { |
---|
| 1291 | + if (o instanceof Object3D) |
---|
| 1292 | + { |
---|
| 1293 | + assert(((Object3D)o).parent == null); |
---|
| 1294 | + } |
---|
| 1295 | + |
---|
1153 | 1296 | if (o == null) |
---|
1154 | 1297 | return null; |
---|
1155 | 1298 | |
---|