Normand Briere
2019-09-18 f9325048496d7cdbcad233f8a6b84c88e79adcc2
Grafreed.java
....@@ -13,6 +13,17 @@
1313
1414 import javax.sound.sampled.*;
1515
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
+
1627 //import com.jamonapi.*;
1728 public class Grafreed extends Applet implements ActionListener
1829 {
....@@ -673,12 +684,18 @@
673684 PlayWord(word, 1);
674685 }
675686
687
+ static boolean isWindows;
688
+
676689 public static void main(String argv[])
677690 {
678
- String osArch = System.getProperty("os.arch");
691
+ String osArch = System.getProperty("os.arch");
679692 if (Globals.DEBUG)
680693 System.out.println("os.arch = " + osArch);
681694
695
+ String osName = System.getProperty("os.name");
696
+
697
+ isWindows = !osName.equals("Mac OS X");
698
+
682699 if (argv.length == 0)
683700 {
684701 String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
....@@ -881,7 +898,6 @@
881898 // try{Thread.sleep(5000);}catch(Exception e){}
882899 // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1);
883900
884
-
885901 /**/
886902 if (Globals.NIMBUSLAF)
887903 {
....@@ -934,6 +950,8 @@
934950
935951 ui = UIManager.getDefaults();
936952
953
+ x = ui.get("RadioButton.icon");
954
+
937955 ArrayList gradient = new java.util.ArrayList(5);
938956 gradient.add(1.0);
939957 gradient.add(0.0);
....@@ -943,9 +961,9 @@
943961
944962 ui.put("Button.gradient", gradient);
945963
946
- //ui.put("RadioButton.icon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
947
- //ui.put("RadioButtonMenuItem.checkIcon", ObjEditor.GetIcon("icons/fit.png"));
948
- //ui.put("RadioButtonMenuItem.arrowIcon", ObjEditor.GetIcon("icons/fit.png"));
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"));
949967
950968 ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0));
951969 ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
....@@ -1010,24 +1028,70 @@
10101028 }
10111029 }
10121030 /**/
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
+ /////////////
10131075
10141076 // javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10151077
10161078 //Monitor mon=MonitorFactory.start("myFirstMonitor");
10171079 standAlone = true;
1018
- grafreed = new Grafreed();
1080
+
1081
+ grafreed = new Grafreed();
1082
+
10191083 grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd"));
10201084
10211085 grafreed.universe = new cGroup();
10221086 grafreed.universe.name = "Grafreed";
10231087 grafreed.universe.material = new cMaterial();
1024
- grafreed.universe.skyboxname = "cubemaps/penguins-skyboxes/yonder";
1025
- grafreed.universe.skyboxext = "jpg";
10261088
10271089 // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
10281090
10291091 grafreed.universe.root = true;
10301092 grafreed.universe.openEditWindow(null, true); //, true);
1093
+ grafreed.universe.editWindow.New();
1094
+
10311095 //mon.stop();
10321096 //System.out.println(mon);
10331097 //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
....@@ -1035,6 +1099,33 @@
10351099 javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS);
10361100 }
10371101
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
+
10381129 static Object3D materials;
10391130
10401131 static Object3D ReadGFD(java.io.InputStream istream)