Advertisement
Guest User

Untitled

a guest
May 2nd, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.90 KB | None | 0 0
  1. /* =========================================================
  2. * ==== WARNING ===
  3. * =========================================================
  4. * The code in this tab has been generated from the GUI form
  5. * designer and care should be taken when editing this file.
  6. * Only add/edit code inside the event handlers i.e. only
  7. * use lines between the matching comment tags. e.g.
  8.  
  9. void myBtnEvents(GButton button) { //_CODE_:button1:12356:
  10. // It is safe to enter your event code here
  11. } //_CODE_:button1:12356:
  12.  
  13. * Do not rename this tab!
  14. * =========================================================
  15. */
  16.  
  17. public void imgButton1_LogoPxl_click(GImageButton source, GEvent event) { //_CODE_:imgButton_LogoPxl:810868:
  18. println("imgButton1 - GImageButton event occured " + System.currentTimeMillis()%10000000 );
  19. link("http://www.pxl.be");
  20. textarea_console.appendText("Visiting PXL webpage ...");
  21. } //_CODE_:imgButton_LogoPxl:810868:
  22.  
  23. public void imgButton_logoGithub_click(GImageButton source, GEvent event) { //_CODE_:imgButton_logoGithub:943067:
  24. println("imgButton1 - GImageButton event occured " + System.currentTimeMillis()%10000000 );
  25. link("https://github.com/Glenn-Kerselaers/PWO_HEALTHCARE_1_DEV");
  26. textarea_console.appendText("Visiting Github repo ...");
  27. } //_CODE_:imgButton_logoGithub:943067:
  28.  
  29. public void imgButton_logoImu_click(GImageButton source, GEvent event) { //_CODE_:imgButton_logoImu:933533:
  30. println("imgButton2 - GImageButton event occured " + System.currentTimeMillis()%10000000 );
  31. link("http://xmotionplus.co.nf/");
  32. textarea_console.appendText("Visiting xMotionPlus webpage ...");
  33. } //_CODE_:imgButton_logoImu:933533:
  34.  
  35. public void textarea_console_change(GTextArea source, GEvent event) { //_CODE_:textarea_console:563522:
  36. println("textarea1 - GTextArea event occured " + System.currentTimeMillis()%10000000 );
  37. } //_CODE_:textarea_console:563522:
  38.  
  39. public void button_start_click(GButton source, GEvent event) { //_CODE_:button_start:906387:
  40. println("button_start - GButton event occured " + System.currentTimeMillis()%10000000 );
  41. startCommunication();
  42. } //_CODE_:button_start:906387:
  43.  
  44. public void button_stop_click(GButton source, GEvent event) { //_CODE_:button_stop:509982:
  45. println("button_stop - GButton event occured " + System.currentTimeMillis()%10000000 );
  46. stopCommunication();
  47. } //_CODE_:button_stop:509982:
  48.  
  49. public void button_clearConsole_click(GButton source, GEvent event) { //_CODE_:button_clearConsole:654478:
  50. println("button_clearConsole - GButton event occured " + System.currentTimeMillis()%10000000 );
  51. textarea_console.setText("");
  52. customGUI();
  53. } //_CODE_:button_clearConsole:654478:
  54.  
  55. public void dropList_baud1_click(GDropList source, GEvent event) { //_CODE_:dropList_baud1:308840:
  56. println("dropList_baud1 - GDropList event occured " + System.currentTimeMillis()%10000000 );
  57. } //_CODE_:dropList_baud1:308840:
  58.  
  59. public void dropList_com1_click(GDropList source, GEvent event) { //_CODE_:dropList_com1:253554:
  60. println("dropList_com1 - GDropList event occured " + System.currentTimeMillis()%10000000 );
  61. } //_CODE_:dropList_com1:253554:
  62.  
  63. public void dropList_baud2_click(GDropList source, GEvent event) { //_CODE_:dropList_baud2:833132:
  64. println("dropList_baud2 - GDropList event occured " + System.currentTimeMillis()%10000000 );
  65. } //_CODE_:dropList_baud2:833132:
  66.  
  67. public void dropList_com2_click1(GDropList source, GEvent event) { //_CODE_:dropList_com2:355172:
  68. println("dropList_com2 - GDropList event occured " + System.currentTimeMillis()%10000000 );
  69. } //_CODE_:dropList_com2:355172:
  70.  
  71. public void button_connect1_click(GButton source, GEvent event) { //_CODE_:button_connect1:530530:
  72. println("button_connect1 - GButton event occured " + System.currentTimeMillis()%10000000 );
  73. connectIMU1();
  74. } //_CODE_:button_connect1:530530:
  75.  
  76. public void button_connect2_click(GButton source, GEvent event) { //_CODE_:button_connect2:851447:
  77. println("button_connect2 - GButton event occured " + System.currentTimeMillis()%10000000 );
  78. connectIMU2();
  79. } //_CODE_:button_connect2:851447:
  80.  
  81. public void button_findSerial_click(GButton source, GEvent event) { //_CODE_:button_findSerial:469101:
  82. println("button_findSerial - GButton event occured " + System.currentTimeMillis()%10000000 );
  83. findSerials();
  84. } //_CODE_:button_findSerial:469101:
  85.  
  86. public void button_autoConnect_click(GButton source, GEvent event) { //_CODE_:button_autoConnect:652736:
  87. println("button_autoConnect - GButton event occured " + System.currentTimeMillis()%10000000 );
  88. autoConnect();
  89. } //_CODE_:button_autoConnect:652736:
  90.  
  91. public void button_openGraph_click(GButton source, GEvent event) { //_CODE_:button_openGraph:455514:
  92. println("button_openGraph - GButton event occured " + System.currentTimeMillis()%10000000 );
  93. window_graph.setVisible(true);
  94. } //_CODE_:button_openGraph:455514:
  95.  
  96. public void button_openAnimation_click(GButton source, GEvent event) { //_CODE_:button_openAnimation:996082:
  97. println("button_openAnimation - GButton event occured " + System.currentTimeMillis()%10000000 );
  98. window_animation.setVisible(true);
  99. } //_CODE_:button_openAnimation:996082:
  100.  
  101. public void textfield_send_change(GTextField source, GEvent event) { //_CODE_:textfield_send:529509:
  102. println("textfield_send - GTextField event occured " + System.currentTimeMillis()%10000000 );
  103. } //_CODE_:textfield_send:529509:
  104.  
  105. public void button_send_click(GButton source, GEvent event) { //_CODE_:button_send:515935:
  106. println("button_send - GButton event occured " + System.currentTimeMillis()%10000000 );
  107. String sInput = textfield_send.getText();
  108. String receiver = dropList_whoSend.getSelectedText();
  109.  
  110. textarea_console.appendText("Send [" + receiver + "]: " + sInput);
  111.  
  112. if (dropList_whoSend.getSelectedIndex() == 0) {
  113. myPorts[0].write(sInput);
  114. }
  115. else if (dropList_whoSend.getSelectedIndex() == 1) {
  116. myPorts[1].write(sInput);
  117. }
  118. else if (dropList_whoSend.getSelectedIndex() == 2) {
  119. myPorts[0].write(sInput);
  120. myPorts[1].write(sInput);
  121. }
  122. textfield_send.setText("");
  123. } //_CODE_:button_send:515935:
  124.  
  125. public void dropList_whoSend_click(GDropList source, GEvent event) { //_CODE_:dropList_whoSend:741946:
  126. println("dropList_whoSend - GDropList event occured " + System.currentTimeMillis()%10000000 );
  127. } //_CODE_:dropList_whoSend:741946:
  128.  
  129. synchronized public void win_graph_draw(GWinApplet appc, GWinData data) { //_CODE_:window_graph:648207:
  130. appc.background(230);
  131. } //_CODE_:window_graph:648207:
  132.  
  133. synchronized public void win_animation_draw(GWinApplet appc, GWinData data) { //_CODE_:window_animation:552405:
  134. appc.background(0);
  135. } //_CODE_:window_animation:552405:
  136.  
  137.  
  138.  
  139. // Create all the GUI controls.
  140. // autogenerated do not edit
  141. public void createGUI() {
  142. G4P.messagesEnabled(false);
  143. G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  144. G4P.setCursor(ARROW);
  145. if (frame != null)
  146. frame.setTitle("xMotionPlus - IMU Developed by PXL {V1.0}");
  147. imgButton_LogoPxl = new GImageButton(this, -1, 300, new String[] {
  148. "logo_pxl_tech_143x60.png", "logo_pxl_tech_143x60.png", "logo_pxl_tech_143x60.png"
  149. }
  150. );
  151. imgButton_LogoPxl.addEventHandler(this, "imgButton1_LogoPxl_click");
  152. label1 = new GLabel(this, 120, 370, 360, 20);
  153. label1.setText("Glenn Kerselaers & Devlin Voets");
  154. label1.setOpaque(false);
  155. imgButton_logoGithub = new GImageButton(this, 150, 300, 146, 60, new String[] {
  156. "logo_github_146x60.png", "logo_github_146x60.png", "logo_github_146x60.png"
  157. }
  158. );
  159. imgButton_logoGithub.addEventHandler(this, "imgButton_logoGithub_click");
  160. imgButton_logoImu = new GImageButton(this, 290, 300, 306, 60, new String[] {
  161. "logo_xmotionplus_306x60.png", "logo_xmotionplus_306x60.png", "logo_xmotionplus_306x60.png"
  162. }
  163. );
  164. imgButton_logoImu.addEventHandler(this, "imgButton_logoImu_click");
  165. textarea_console = new GTextArea(this, 330, 60, 248, 200, G4P.SCROLLBARS_VERTICAL_ONLY | G4P.SCROLLBARS_AUTOHIDE);
  166. textarea_console.setOpaque(true);
  167. textarea_console.addEventHandler(this, "textarea_console_change");
  168. label2 = new GLabel(this, 330, 40, 127, 20);
  169. label2.setText("Console window");
  170. label2.setTextBold();
  171. label2.setOpaque(false);
  172. button_start = new GButton(this, 325, 10, 80, 30);
  173. button_start.setText("Start");
  174. button_start.setTextBold();
  175. button_start.addEventHandler(this, "button_start_click");
  176. button_stop = new GButton(this, 415, 10, 80, 30);
  177. button_stop.setText("Stop");
  178. button_stop.setTextBold();
  179. button_stop.addEventHandler(this, "button_stop_click");
  180. button_clearConsole = new GButton(this, 505, 10, 80, 30);
  181. button_clearConsole.setText("Clear");
  182. button_clearConsole.setTextBold();
  183. button_clearConsole.addEventHandler(this, "button_clearConsole_click");
  184. dropList_baud1 = new GDropList(this, 110, 155, 90, 66, 3);
  185. dropList_baud1.setItems(loadStrings("list_308840"), 0);
  186. dropList_baud1.addEventHandler(this, "dropList_baud1_click");
  187. dropList_com1 = new GDropList(this, 10, 155, 90, 66, 3);
  188. dropList_com1.setItems(loadStrings("list_253554"), 0);
  189. dropList_com1.addEventHandler(this, "dropList_com1_click");
  190. dropList_baud2 = new GDropList(this, 110, 205, 90, 63, 3);
  191. dropList_baud2.setItems(loadStrings("list_833132"), 0);
  192. dropList_baud2.addEventHandler(this, "dropList_baud2_click");
  193. dropList_com2 = new GDropList(this, 10, 205, 90, 66, 3);
  194. dropList_com2.setItems(loadStrings("list_355172"), 0);
  195. dropList_com2.addEventHandler(this, "dropList_com2_click1");
  196. label3 = new GLabel(this, 10, 185, 192, 20);
  197. label3.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  198. label3.setText("IMU-Module #2");
  199. label3.setTextBold();
  200. label3.setOpaque(false);
  201. label4 = new GLabel(this, 10, 135, 192, 20);
  202. label4.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  203. label4.setText("IMU-Module #1");
  204. label4.setTextBold();
  205. label4.setOpaque(false);
  206. button_connect1 = new GButton(this, 210, 150, 80, 30);
  207. button_connect1.setText("Connect");
  208. button_connect1.setTextBold();
  209. button_connect1.addEventHandler(this, "button_connect1_click");
  210. button_connect2 = new GButton(this, 210, 200, 80, 30);
  211. button_connect2.setText("Connect");
  212. button_connect2.setTextBold();
  213. button_connect2.addEventHandler(this, "button_connect2_click");
  214. button_findSerial = new GButton(this, 15, 10, 80, 30);
  215. button_findSerial.setText("Find Serials");
  216. button_findSerial.setTextBold();
  217. button_findSerial.addEventHandler(this, "button_findSerial_click");
  218. togGroup1 = new GToggleGroup();
  219. button_autoConnect = new GButton(this, 15, 50, 80, 30);
  220. button_autoConnect.setText("Auto-Connect");
  221. button_autoConnect.setTextBold();
  222. button_autoConnect.addEventHandler(this, "button_autoConnect_click");
  223. button_openGraph = new GButton(this, 110, 10, 80, 30);
  224. button_openGraph.setText("Open Graph");
  225. button_openGraph.setTextBold();
  226. button_openGraph.addEventHandler(this, "button_openGraph_click");
  227. button_openAnimation = new GButton(this, 109, 49, 80, 30);
  228. button_openAnimation.setText("Open Animation");
  229. button_openAnimation.setTextBold();
  230. button_openAnimation.addEventHandler(this, "button_openAnimation_click");
  231. textfield_send = new GTextField(this, 330, 270, 160, 21, G4P.SCROLLBARS_NONE);
  232. textfield_send.setOpaque(true);
  233. textfield_send.addEventHandler(this, "textfield_send_change");
  234. button_send = new GButton(this, 500, 265, 80, 30);
  235. button_send.setText("Send");
  236. button_send.setTextBold();
  237. button_send.addEventHandler(this, "button_send_click");
  238. dropList_whoSend = new GDropList(this, 230, 270, 90, 66, 3);
  239. dropList_whoSend.setItems(loadStrings("list_741946"), 0);
  240. dropList_whoSend.addEventHandler(this, "dropList_whoSend_click");
  241. window_graph = new GWindow(this, "Graph", 0, 0, 240, 120, false, JAVA2D);
  242. window_graph.setActionOnClose(G4P.CLOSE_WINDOW);
  243. window_graph.addDrawHandler(this, "win_graph_draw");
  244. window_animation = new GWindow(this, "Animation", 0, 0, 640, 360, false, JAVA2D);
  245. window_animation.setActionOnClose(G4P.CLOSE_WINDOW);
  246. window_animation.addDrawHandler(this, "win_animation_draw");
  247. sketchPad_animation = new GSketchPad(window_animation.papplet, 0, 0, 640, 360);
  248. sketchPad_animation.setOpaque(false);
  249. }
  250.  
  251. // Variable declarations
  252. // autogenerated do not edit
  253. GImageButton imgButton_LogoPxl;
  254. GLabel label1;
  255. GImageButton imgButton_logoGithub;
  256. GImageButton imgButton_logoImu;
  257. GTextArea textarea_console;
  258. GLabel label2;
  259. GButton button_start;
  260. GButton button_stop;
  261. GButton button_clearConsole;
  262. GDropList dropList_baud1;
  263. GDropList dropList_com1;
  264. GDropList dropList_baud2;
  265. GDropList dropList_com2;
  266. GLabel label3;
  267. GLabel label4;
  268. GButton button_connect1;
  269. GButton button_connect2;
  270. GButton button_findSerial;
  271. GToggleGroup togGroup1;
  272. GButton button_autoConnect;
  273. GButton button_openGraph;
  274. GButton button_openAnimation;
  275. GTextField textfield_send;
  276. GButton button_send;
  277. GDropList dropList_whoSend;
  278. GWindow window_graph;
  279. GWindow window_animation;
  280. GSketchPad sketchPad_animation;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement