1 package demo.poa_monitor.client; 2 3 4 5 10 11 public class TestFrame extends java.awt.Frame implements java.awt.event.ActionListener , java.awt.event.AdjustmentListener , java.awt.event.WindowListener { 12 13 private java.awt.Panel ivjButtonPanel = null; 14 15 private java.awt.FlowLayout ivjButtonPanelFlowLayout = null; 16 17 private java.awt.Label ivjComputationLabel = null; 18 19 private java.awt.Panel ivjContentsPane = null; 20 21 private java.awt.Label ivjInvocationLabel = null; 22 23 private java.awt.Label ivjNumberLabel = null; 24 25 private java.awt.TextField ivjNumberTextField = null; 26 27 private java.awt.Label ivjSpeedLabel = null; 28 29 private java.awt.Scrollbar ivjSpeedScrollbar = null; 30 31 private java.awt.Label ivjThreadsLabel = null; 32 33 private java.awt.TextField ivjThreadsTextField = null; 34 35 private java.awt.Button ivjCancelButton = null; 36 37 private java.awt.Button ivjStartButton = null; 38 39 private java.awt.Button ivjStopButton = null; 40 41 private java.awt.Panel ivjWorkPanel = null; 42 43 private java.awt.Label ivjCostLabel = null; 44 45 private java.awt.Scrollbar ivjCostScrollbar = null; 46 47 private java.awt.Label ivjDescriptionLabel = null; 48 49 private java.awt.Label ivjServerLabel = null; 50 51 private java.awt.BorderLayout ivjContentsPaneBorderLayout = null; 52 53 private java.awt.BorderLayout ivjTestFrameBorderLayout = null; 54 55 60 61 62 63 public TestFrame() { 64 65 super(); 66 67 initialize(); 68 69 } 70 71 78 79 public TestFrame(String title) { 80 81 super(title); 82 83 } 84 85 private void _actionCancelButtonPressed() { 86 87 Client.actionCancel(); 88 89 } 90 91 private void _actionCostbarValueChanged(int value) { 92 93 if (value == 0) { 94 95 getCostLabel().setText("no cost"); 96 97 Client.cost = value; 98 99 100 101 } else if (value < 11) { 102 103 getCostLabel().setText("0 - "+((value)*100)+" msec"); 104 105 Client.cost = value*100; 106 107 108 109 } else { 110 111 getCostLabel().setText("0 - "+((value)*200)+" msec"); 112 113 Client.cost = value*200; 114 115 } 116 117 } 118 119 private void _actionSpeedbarValueChanged(int value) { 120 121 if (value == 0) { 122 123 getSpeedLabel().setText("no delay"); 124 125 Client.speed = value; 126 127 128 129 } else if (value < 11) { 130 131 getSpeedLabel().setText("0 - "+((value)*100)+" msec"); 132 133 Client.speed = value*100; 134 135 136 137 } else { 138 139 getSpeedLabel().setText("0 - "+((value)*200)+" msec"); 140 141 Client.speed = value*200; 142 143 } 144 145 } 146 147 private void _actionStartButtonPressed(String objects, String threads) { 148 149 getNumberLabel().setEnabled(false); 150 151 getNumberTextField().setEnabled(false); 152 153 getThreadsLabel().setEnabled(false); 154 155 getThreadsTextField().setEnabled(false); 156 157 getStartButton().setEnabled(false); 158 159 160 161 Client.actionStart(Integer.parseInt(objects), Integer.parseInt(threads)); 162 163 } 164 165 private void _actionStopButtonPressed() { 166 167 getNumberLabel().setEnabled(true); 168 169 getNumberTextField().setEnabled(true); 170 171 getThreadsLabel().setEnabled(true); 172 173 getThreadsTextField().setEnabled(true); 174 175 getStartButton().setEnabled(true); 176 177 178 179 Client.actionStop(); 180 181 } 182 183 190 191 192 193 public void actionPerformed(java.awt.event.ActionEvent e) { 194 195 197 199 if ((e.getSource() == getStartButton()) ) { 200 201 connEtoC4(e); 202 203 } 204 205 if ((e.getSource() == getStopButton()) ) { 206 207 connEtoC5(e); 208 209 } 210 211 if ((e.getSource() == getCancelButton()) ) { 212 213 connEtoC6(e); 214 215 } 216 217 219 221 } 222 223 230 231 232 233 public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e) { 234 235 237 239 if ((e.getSource() == getSpeedScrollbar()) ) { 240 241 connEtoC2(e); 242 243 } 244 245 if ((e.getSource() == getCostScrollbar()) ) { 246 247 connEtoC3(e); 248 249 } 250 251 253 255 } 256 257 264 265 266 267 private void connEtoC1(java.awt.event.WindowEvent arg1) { 268 269 try { 270 271 273 275 this.dispose(); 276 277 279 281 } catch (java.lang.Throwable ivjExc) { 282 283 285 287 handleException(ivjExc); 288 289 } 290 291 } 292 293 300 301 302 303 private void connEtoC2(java.awt.event.ActionEvent arg1) { 304 305 try { 306 307 309 311 this._actionCancelButtonPressed(); 312 313 315 317 } catch (java.lang.Throwable ivjExc) { 318 319 321 323 handleException(ivjExc); 324 325 } 326 327 } 328 329 336 337 338 339 private void connEtoC2(java.awt.event.AdjustmentEvent arg1) { 340 341 try { 342 343 345 347 this._actionSpeedbarValueChanged(getSpeedScrollbar().getValue()); 348 349 351 353 } catch (java.lang.Throwable ivjExc) { 354 355 357 359 handleException(ivjExc); 360 361 } 362 363 } 364 365 372 373 374 375 private void connEtoC3(java.awt.event.ActionEvent arg1) { 376 377 try { 378 379 381 383 this._actionStopButtonPressed(); 384 385 387 389 } catch (java.lang.Throwable ivjExc) { 390 391 393 395 handleException(ivjExc); 396 397 } 398 399 } 400 401 408 409 410 411 private void connEtoC3(java.awt.event.AdjustmentEvent arg1) { 412 413 try { 414 415 417 419 this._actionCostbarValueChanged(getCostScrollbar().getValue()); 420 421 423 425 } catch (java.lang.Throwable ivjExc) { 426 427 429 431 handleException(ivjExc); 432 433 } 434 435 } 436 437 444 445 446 447 private void connEtoC4(java.awt.event.ActionEvent arg1) { 448 449 try { 450 451 453 455 this._actionStartButtonPressed(getNumberTextField().getText(), getThreadsTextField().getText()); 456 457 459 461 } catch (java.lang.Throwable ivjExc) { 462 463 465 467 handleException(ivjExc); 468 469 } 470 471 } 472 473 480 481 482 483 private void connEtoC5(java.awt.event.ActionEvent arg1) { 484 485 try { 486 487 489 491 this._actionStopButtonPressed(); 492 493 495 497 } catch (java.lang.Throwable ivjExc) { 498 499 501 503 handleException(ivjExc); 504 505 } 506 507 } 508 509 516 517 518 519 private void connEtoC5(java.awt.event.AdjustmentEvent arg1) { 520 521 try { 522 523 525 527 this._actionSpeedbarValueChanged(getSpeedScrollbar().getValue()); 528 529 531 533 } catch (java.lang.Throwable ivjExc) { 534 535 537 539 handleException(ivjExc); 540 541 } 542 543 } 544 545 552 553 554 555 private void connEtoC6(java.awt.event.ActionEvent arg1) { 556 557 try { 558 559 561 563 this._actionCancelButtonPressed(); 564 565 567 569 } catch (java.lang.Throwable ivjExc) { 570 571 573 575 handleException(ivjExc); 576 577 } 578 579 } 580 581 588 589 590 591 private void connEtoC6(java.awt.event.AdjustmentEvent arg1) { 592 593 try { 594 595 597 599 this._actionCostbarValueChanged(getCostScrollbar().getValue()); 600 601 603 605 } catch (java.lang.Throwable ivjExc) { 606 607 609 611 handleException(ivjExc); 612 613 } 614 615 } 616 617 624 625 626 627 private java.awt.Panel getButtonPanel() { 628 629 if (ivjButtonPanel == null) { 630 631 try { 632 633 ivjButtonPanel = new java.awt.Panel (); 634 635 ivjButtonPanel.setName("ButtonPanel"); 636 637 ivjButtonPanel.setLayout(getButtonPanelFlowLayout()); 638 639 ivjButtonPanel.setBackground(java.awt.SystemColor.control); 640 641 getButtonPanel().add(getStartButton(), getStartButton().getName()); 642 643 getButtonPanel().add(getStopButton(), getStopButton().getName()); 644 645 getButtonPanel().add(getCancelButton(), getCancelButton().getName()); 646 647 649 651 } catch (java.lang.Throwable ivjExc) { 652 653 655 657 handleException(ivjExc); 658 659 } 660 661 }; 662 663 return ivjButtonPanel; 664 665 } 666 667 674 675 676 677 private java.awt.FlowLayout getButtonPanelFlowLayout() { 678 679 java.awt.FlowLayout ivjButtonPanelFlowLayout = null; 680 681 try { 682 683 684 685 ivjButtonPanelFlowLayout = new java.awt.FlowLayout (); 686 687 ivjButtonPanelFlowLayout.setAlignment(java.awt.FlowLayout.RIGHT); 688 689 ivjButtonPanelFlowLayout.setVgap(5); 690 691 ivjButtonPanelFlowLayout.setHgap(10); 692 693 } catch (java.lang.Throwable ivjExc) { 694 695 handleException(ivjExc); 696 697 }; 698 699 return ivjButtonPanelFlowLayout; 700 701 } 702 703 710 711 712 713 private java.awt.Button getCancelButton() { 714 715 if (ivjCancelButton == null) { 716 717 try { 718 719 ivjCancelButton = new java.awt.Button (); 720 721 ivjCancelButton.setName("CancelButton"); 722 723 ivjCancelButton.setBackground(java.awt.SystemColor.control); 724 725 ivjCancelButton.setActionCommand(" Cancel "); 726 727 ivjCancelButton.setLabel(" Cancel "); 728 729 731 733 } catch (java.lang.Throwable ivjExc) { 734 735 737 739 handleException(ivjExc); 740 741 } 742 743 }; 744 745 return ivjCancelButton; 746 747 } 748 749 756 757 758 759 private java.awt.Label getComputationLabel() { 760 761 if (ivjComputationLabel == null) { 762 763 try { 764 765 ivjComputationLabel = new java.awt.Label (); 766 767 ivjComputationLabel.setName("ComputationLabel"); 768 769 ivjComputationLabel.setLocation(new java.awt.Point (20, 185)); 770 771 ivjComputationLabel.setText("Computation cost on server"); 772 773 ivjComputationLabel.setBackground(java.awt.SystemColor.control); 774 775 ivjComputationLabel.setSize(new java.awt.Dimension (130, 12)); 776 777 ivjComputationLabel.setForeground(java.awt.Color.black); 778 779 ivjComputationLabel.setFont(new java.awt.Font ("dialog", 2, 10)); 780 781 ivjComputationLabel.setBounds(new java.awt.Rectangle (20, 185, 130, 12)); 782 783 ivjComputationLabel.setAlignment(java.awt.Label.LEFT); 784 785 ivjComputationLabel.setBounds(20, 185, 130, 12); 786 787 789 791 } catch (java.lang.Throwable ivjExc) { 792 793 795 797 handleException(ivjExc); 798 799 } 800 801 }; 802 803 return ivjComputationLabel; 804 805 } 806 807 814 815 816 817 private java.awt.Panel getContentsPane() { 818 819 if (ivjContentsPane == null) { 820 821 try { 822 823 ivjContentsPane = new java.awt.Panel (); 824 825 ivjContentsPane.setName("ContentsPane"); 826 827 ivjContentsPane.setLayout(getContentsPaneBorderLayout()); 828 829 ivjContentsPane.setBackground(java.awt.SystemColor.control); 830 831 getContentsPane().add(getButtonPanel(), "South"); 832 833 getContentsPane().add(getWorkPanel(), "Center"); 834 835 837 839 } catch (java.lang.Throwable ivjExc) { 840 841 843 845 handleException(ivjExc); 846 847 } 848 849 }; 850 851 return ivjContentsPane; 852 853 } 854 855 862 863 864 865 private java.awt.BorderLayout getContentsPaneBorderLayout() { 866 867 java.awt.BorderLayout ivjContentsPaneBorderLayout = null; 868 869 try { 870 871 872 873 ivjContentsPaneBorderLayout = new java.awt.BorderLayout (); 874 875 ivjContentsPaneBorderLayout.setVgap(0); 876 877 ivjContentsPaneBorderLayout.setHgap(0); 878 879 } catch (java.lang.Throwable ivjExc) { 880 881 handleException(ivjExc); 882 883 }; 884 885 return ivjContentsPaneBorderLayout; 886 887 } 888 889 896 897 898 899 private java.awt.Label getCostLabel() { 900 901 if (ivjCostLabel == null) { 902 903 try { 904 905 ivjCostLabel = new java.awt.Label (); 906 907 ivjCostLabel.setName("CostLabel"); 908 909 ivjCostLabel.setLocation(new java.awt.Point (170, 197)); 910 911 ivjCostLabel.setText("no cost"); 912 913 ivjCostLabel.setBackground(java.awt.SystemColor.control); 914 915 ivjCostLabel.setSize(new java.awt.Dimension (80, 23)); 916 917 ivjCostLabel.setForeground(java.awt.Color.red); 918 919 ivjCostLabel.setFont(new java.awt.Font ("dialog", 1, 12)); 920 921 ivjCostLabel.setBounds(new java.awt.Rectangle (170, 197, 80, 23)); 922 923 ivjCostLabel.setAlignment(2); 924 925 ivjCostLabel.setBounds(150, 197, 100, 23); 926 927 929 931 } catch (java.lang.Throwable ivjExc) { 932 933 935 937 handleException(ivjExc); 938 939 } 940 941 }; 942 943 return ivjCostLabel; 944 945 } 946 947 954 955 956 957 private java.awt.Scrollbar getCostScrollbar() { 958 959 if (ivjCostScrollbar == null) { 960 961 try { 962 963 ivjCostScrollbar = new java.awt.Scrollbar (); 964 965 ivjCostScrollbar.setName("CostScrollbar"); 966 967 ivjCostScrollbar.setLocation(new java.awt.Point (20, 200)); 968 969 ivjCostScrollbar.setSize(new java.awt.Dimension (130, 18)); 970 971 ivjCostScrollbar.setBounds(new java.awt.Rectangle (20, 200, 130, 18)); 972 973 ivjCostScrollbar.setBounds(20, 200, 120, 18); 974 975 ivjCostScrollbar.setOrientation(java.awt.Scrollbar.HORIZONTAL); 976 977 979 981 } catch (java.lang.Throwable ivjExc) { 982 983 985 987 handleException(ivjExc); 988 989 } 990 991 }; 992 993 return ivjCostScrollbar; 994 995 } 996 997 1004 1005 1006 1007private java.awt.Label getDescriptionLabel() { 1008 1009 if (ivjDescriptionLabel == null) { 1010 1011 try { 1012 1013 ivjDescriptionLabel = new java.awt.Label (); 1014 1015 ivjDescriptionLabel.setName("DescriptionLabel"); 1016 1017 ivjDescriptionLabel.setLocation(new java.awt.Point (10, 35)); 1018 1019 ivjDescriptionLabel.setText("description not available"); 1020 1021 ivjDescriptionLabel.setBackground(java.awt.SystemColor.control); 1022 1023 ivjDescriptionLabel.setSize(new java.awt.Dimension (260, 23)); 1024 1025 ivjDescriptionLabel.setForeground(java.awt.Color.black); 1026 1027 ivjDescriptionLabel.setFont(new java.awt.Font ("dialog", 3, 12)); 1028 1029 ivjDescriptionLabel.setBounds(new java.awt.Rectangle (10, 35, 260, 23)); 1030 1031 ivjDescriptionLabel.setAlignment(1); 1032 1033 ivjDescriptionLabel.setBounds(10, 35, 260, 23); 1034 1035 1037 1039 } catch (java.lang.Throwable ivjExc) { 1040 1041 1043 1045 handleException(ivjExc); 1046 1047 } 1048 1049 }; 1050 1051 return ivjDescriptionLabel; 1052 1053} 1054 1055 1062 1063 1064 1065private java.awt.Label getInvocationLabel() { 1066 1067 if (ivjInvocationLabel == null) { 1068 1069 try { 1070 1071 ivjInvocationLabel = new java.awt.Label (); 1072 1073 ivjInvocationLabel.setName("InvocationLabel"); 1074 1075 ivjInvocationLabel.setLocation(new java.awt.Point (20, 145)); 1076 1077 ivjInvocationLabel.setText("Invocation delay on client"); 1078 1079 ivjInvocationLabel.setBackground(java.awt.SystemColor.control); 1080 1081 ivjInvocationLabel.setSize(new java.awt.Dimension (130, 12)); 1082 1083 ivjInvocationLabel.setForeground(java.awt.Color.black); 1084 1085 ivjInvocationLabel.setFont(new java.awt.Font ("dialog", 2, 10)); 1086 1087 ivjInvocationLabel.setBounds(new java.awt.Rectangle (20, 145, 130, 12)); 1088 1089 ivjInvocationLabel.setAlignment(java.awt.Label.LEFT); 1090 1091 ivjInvocationLabel.setBounds(20, 145, 130, 12); 1092 1093 1095 1097 } catch (java.lang.Throwable ivjExc) { 1098 1099 1101 1103 handleException(ivjExc); 1104 1105 } 1106 1107 }; 1108 1109 return ivjInvocationLabel; 1110 1111} 1112 1113 1120 1121 1122 1123private java.awt.Label getNumberLabel() { 1124 1125 if (ivjNumberLabel == null) { 1126 1127 try { 1128 1129 ivjNumberLabel = new java.awt.Label (); 1130 1131 ivjNumberLabel.setName("NumberLabel"); 1132 1133 ivjNumberLabel.setLocation(new java.awt.Point (20, 70)); 1134 1135 ivjNumberLabel.setText("Number of objects:"); 1136 1137 ivjNumberLabel.setBackground(java.awt.SystemColor.control); 1138 1139 ivjNumberLabel.setSize(new java.awt.Dimension (110, 23)); 1140 1141 ivjNumberLabel.setFont(new java.awt.Font ("dialog", 2, 12)); 1142 1143 ivjNumberLabel.setBounds(new java.awt.Rectangle (20, 70, 110, 23)); 1144 1145 ivjNumberLabel.setBounds(20, 70, 110, 23); 1146 1147 1149 1151 } catch (java.lang.Throwable ivjExc) { 1152 1153 1155 1157 handleException(ivjExc); 1158 1159 } 1160 1161 }; 1162 1163 return ivjNumberLabel; 1164 1165} 1166 1167 1174 1175 1176 1177private java.awt.TextField getNumberTextField() { 1178 1179 if (ivjNumberTextField == null) { 1180 1181 try { 1182 1183 ivjNumberTextField = new java.awt.TextField (); 1184 1185 ivjNumberTextField.setName("NumberTextField"); 1186 1187 ivjNumberTextField.setLocation(new java.awt.Point (170, 70)); 1188 1189 ivjNumberTextField.setText("1"); 1190 1191 ivjNumberTextField.setBackground(java.awt.Color.white); 1192 1193 ivjNumberTextField.setSize(new java.awt.Dimension (80, 23)); 1194 1195 ivjNumberTextField.setBounds(new java.awt.Rectangle (170, 70, 80, 23)); 1196 1197 ivjNumberTextField.setBounds(170, 66, 80, 30); 1198 1199 1201 1203 } catch (java.lang.Throwable ivjExc) { 1204 1205 1207 1209 handleException(ivjExc); 1210 1211 } 1212 1213 }; 1214 1215 return ivjNumberTextField; 1216 1217} 1218 1219 1226 1227 1228 1229private java.awt.Label getServerLabel() { 1230 1231 if (ivjServerLabel == null) { 1232 1233 try { 1234 1235 ivjServerLabel = new java.awt.Label (); 1236 1237 ivjServerLabel.setName("ServerLabel"); 1238 1239 ivjServerLabel.setLocation(new java.awt.Point (20, 20)); 1240 1241 ivjServerLabel.setText("Server description:"); 1242 1243 ivjServerLabel.setBackground(java.awt.SystemColor.control); 1244 1245 ivjServerLabel.setSize(new java.awt.Dimension (240, 12)); 1246 1247 ivjServerLabel.setFont(new java.awt.Font ("dialog", 2, 10)); 1248 1249 ivjServerLabel.setBounds(new java.awt.Rectangle (20, 20, 240, 12)); 1250 1251 ivjServerLabel.setAlignment(1); 1252 1253 ivjServerLabel.setBounds(20, 20, 240, 12); 1254 1255 1257 1259 } catch (java.lang.Throwable ivjExc) { 1260 1261 1263 1265 handleException(ivjExc); 1266 1267 } 1268 1269 }; 1270 1271 return ivjServerLabel; 1272 1273} 1274 1275 1282 1283 1284 1285private java.awt.Label getSpeedLabel() { 1286 1287 if (ivjSpeedLabel == null) { 1288 1289 try { 1290 1291 ivjSpeedLabel = new java.awt.Label (); 1292 1293 ivjSpeedLabel.setName("SpeedLabel"); 1294 1295 ivjSpeedLabel.setLocation(new java.awt.Point (170, 157)); 1296 1297 ivjSpeedLabel.setText("no delay"); 1298 1299 ivjSpeedLabel.setBackground(java.awt.SystemColor.control); 1300 1301 ivjSpeedLabel.setSize(new java.awt.Dimension (80, 23)); 1302 1303 ivjSpeedLabel.setForeground(java.awt.Color.red); 1304 1305 ivjSpeedLabel.setFont(new java.awt.Font ("dialog", 1, 12)); 1306 1307 ivjSpeedLabel.setBounds(new java.awt.Rectangle (170, 157, 80, 23)); 1308 1309 ivjSpeedLabel.setAlignment(2); 1310 1311 ivjSpeedLabel.setBounds(150, 157, 100, 23); 1312 1313 1315 1317 } catch (java.lang.Throwable ivjExc) { 1318 1319 1321 1323 handleException(ivjExc); 1324 1325 } 1326 1327 }; 1328 1329 return ivjSpeedLabel; 1330 1331} 1332 1333 1340 1341 1342 1343private java.awt.Scrollbar getSpeedScrollbar() { 1344 1345 if (ivjSpeedScrollbar == null) { 1346 1347 try { 1348 1349 ivjSpeedScrollbar = new java.awt.Scrollbar (); 1350 1351 ivjSpeedScrollbar.setName("SpeedScrollbar"); 1352 1353 ivjSpeedScrollbar.setLocation(new java.awt.Point (20, 160)); 1354 1355 ivjSpeedScrollbar.setSize(new java.awt.Dimension (130, 18)); 1356 1357 ivjSpeedScrollbar.setBounds(new java.awt.Rectangle (20, 160, 130, 18)); 1358 1359 ivjSpeedScrollbar.setBounds(20, 160, 120, 18); 1360 1361 ivjSpeedScrollbar.setOrientation(java.awt.Scrollbar.HORIZONTAL); 1362 1363 1365 1367 } catch (java.lang.Throwable ivjExc) { 1368 1369 1371 1373 handleException(ivjExc); 1374 1375 } 1376 1377 }; 1378 1379 return ivjSpeedScrollbar; 1380 1381} 1382 1383 1390 1391 1392 1393private java.awt.Button getStartButton() { 1394 1395 if (ivjStartButton == null) { 1396 1397 try { 1398 1399 ivjStartButton = new java.awt.Button (); 1400 1401 ivjStartButton.setName("StartButton"); 1402 1403 ivjStartButton.setBackground(java.awt.SystemColor.control); 1404 1405 ivjStartButton.setActionCommand(" Start "); 1406 1407 ivjStartButton.setLabel(" Start "); 1408 1409 1411 1413 } catch (java.lang.Throwable ivjExc) { 1414 1415 1417 1419 handleException(ivjExc); 1420 1421 } 1422 1423 }; 1424 1425 return ivjStartButton; 1426 1427} 1428 1429 1436 1437 1438 1439private java.awt.Button getStopButton() { 1440 1441 if (ivjStopButton == null) { 1442 1443 try { 1444 1445 ivjStopButton = new java.awt.Button (); 1446 1447 ivjStopButton.setName("StopButton"); 1448 1449 ivjStopButton.setBackground(java.awt.SystemColor.control); 1450 1451 ivjStopButton.setActionCommand(" Stop "); 1452 1453 ivjStopButton.setLabel(" Stop "); 1454 1455 1457 1459 } catch (java.lang.Throwable ivjExc) { 1460 1461 1463 1465 handleException(ivjExc); 1466 1467 } 1468 1469 }; 1470 1471 return ivjStopButton; 1472 1473} 1474 1475 1482 1483 1484 1485private java.awt.BorderLayout getTestFrameBorderLayout() { 1486 1487 java.awt.BorderLayout ivjTestFrameBorderLayout = null; 1488 1489 try { 1490 1491 1492 1493 ivjTestFrameBorderLayout = new java.awt.BorderLayout (); 1494 1495 ivjTestFrameBorderLayout.setVgap(0); 1496 1497 ivjTestFrameBorderLayout.setHgap(0); 1498 1499 } catch (java.lang.Throwable ivjExc) { 1500 1501 handleException(ivjExc); 1502 1503 }; 1504 1505 return ivjTestFrameBorderLayout; 1506 1507} 1508 1509 1516 1517 1518 1519private java.awt.Label getThreadsLabel() { 1520 1521 if (ivjThreadsLabel == null) { 1522 1523 try { 1524 1525 ivjThreadsLabel = new java.awt.Label (); 1526 1527 ivjThreadsLabel.setName("ThreadsLabel"); 1528 1529 ivjThreadsLabel.setLocation(new java.awt.Point (20, 105)); 1530 1531 ivjThreadsLabel.setText("Threads per object:"); 1532 1533 ivjThreadsLabel.setBackground(java.awt.SystemColor.control); 1534 1535 ivjThreadsLabel.setSize(new java.awt.Dimension (110, 23)); 1536 1537 ivjThreadsLabel.setFont(new java.awt.Font ("dialog", 2, 12)); 1538 1539 ivjThreadsLabel.setBounds(new java.awt.Rectangle (20, 105, 110, 23)); 1540 1541 ivjThreadsLabel.setBounds(20, 105, 110, 23); 1542 1543 1545 1547 } catch (java.lang.Throwable ivjExc) { 1548 1549 1551 1553 handleException(ivjExc); 1554 1555 } 1556 1557 }; 1558 1559 return ivjThreadsLabel; 1560 1561} 1562 1563 1570 1571 1572 1573private java.awt.TextField getThreadsTextField() { 1574 1575 if (ivjThreadsTextField == null) { 1576 1577 try { 1578 1579 ivjThreadsTextField = new java.awt.TextField (); 1580 1581 ivjThreadsTextField.setName("ThreadsTextField"); 1582 1583 ivjThreadsTextField.setLocation(new java.awt.Point (170, 105)); 1584 1585 ivjThreadsTextField.setText("1"); 1586 1587 ivjThreadsTextField.setBackground(new java.awt.Color (255,255,255)); 1588 1589 ivjThreadsTextField.setSize(new java.awt.Dimension (80, 23)); 1590 1591 ivjThreadsTextField.setBounds(new java.awt.Rectangle (170, 105, 80, 23)); 1592 1593 ivjThreadsTextField.setBounds(170, 101, 80, 30); 1594 1595 1597 1599 } catch (java.lang.Throwable ivjExc) { 1600 1601 1603 1605 handleException(ivjExc); 1606 1607 } 1608 1609 }; 1610 1611 return ivjThreadsTextField; 1612 1613} 1614 1615 1622 1623 1624 1625private java.awt.Panel getWorkPanel() { 1626 1627 if (ivjWorkPanel == null) { 1628 1629 try { 1630 1631 ivjWorkPanel = new java.awt.Panel (); 1632 1633 ivjWorkPanel.setName("WorkPanel"); 1634 1635 ivjWorkPanel.setLayout(null); 1636 1637 ivjWorkPanel.setBackground(java.awt.SystemColor.control); 1638 1639 getWorkPanel().add(getNumberLabel(), getNumberLabel().getName()); 1640 1641 getWorkPanel().add(getThreadsLabel(), getThreadsLabel().getName()); 1642 1643 getWorkPanel().add(getNumberTextField(), getNumberTextField().getName()); 1644 1645 getWorkPanel().add(getThreadsTextField(), getThreadsTextField().getName()); 1646 1647 getWorkPanel().add(getSpeedScrollbar(), getSpeedScrollbar().getName()); 1648 1649 getWorkPanel().add(getCostScrollbar(), getCostScrollbar().getName()); 1650 1651 getWorkPanel().add(getInvocationLabel(), getInvocationLabel().getName()); 1652 1653 getWorkPanel().add(getComputationLabel(), getComputationLabel().getName()); 1654 1655 getWorkPanel().add(getSpeedLabel(), getSpeedLabel().getName()); 1656 1657 getWorkPanel().add(getCostLabel(), getCostLabel().getName()); 1658 1659 getWorkPanel().add(getServerLabel(), getServerLabel().getName()); 1660 1661 getWorkPanel().add(getDescriptionLabel(), getDescriptionLabel().getName()); 1662 1663 1665 1667 } catch (java.lang.Throwable ivjExc) { 1668 1669 1671 1673 handleException(ivjExc); 1674 1675 } 1676 1677 }; 1678 1679 return ivjWorkPanel; 1680 1681} 1682 1683 1690 1691private void handleException(Throwable exception) { 1692 1693 1694 1695 1696 1697 1699 1701} 1702 1703 1708 1709 1710 1711private void initConnections() { 1712 1713 1715 1717 this.addWindowListener(this); 1718 1719 getSpeedScrollbar().addAdjustmentListener(this); 1720 1721 getCostScrollbar().addAdjustmentListener(this); 1722 1723 getStartButton().addActionListener(this); 1724 1725 getStopButton().addActionListener(this); 1726 1727 getCancelButton().addActionListener(this); 1728 1729} 1730 1731 1736 1737 1738 1739private void initialize() { 1740 1741 1743 1745 setName("TestFrame"); 1746 1747 setLayout(getTestFrameBorderLayout()); 1748 1749 setBackground(java.awt.SystemColor.control); 1750 1751 setSize(new java.awt.Dimension (280, 310)); 1752 1753 setBounds(new java.awt.Rectangle (0, 0, 280, 310)); 1754 1755 setSize(280, 310); 1756 1757 setTitle("Test Client"); 1758 1759 add(getContentsPane(), "Center"); 1760 1761 initConnections(); 1762 1763 1765 getDescriptionLabel().setText(Client.serverDescription); 1766 1767 1769} 1770 1771 1778 1779public static void main(java.lang.String [] args) { 1780 1781 try { 1782 1783 TestFrame aTestFrame; 1784 1785 aTestFrame = new TestFrame(); 1786 1787 try { 1788 1789 Class aCloserClass = Class.forName("com.ibm.uvm.abt.edit.WindowCloser"); 1790 1791 Class parmTypes[] = { java.awt.Window .class }; 1792 1793 Object parms[] = { aTestFrame }; 1794 1795 java.lang.reflect.Constructor aCtor = aCloserClass.getConstructor(parmTypes); 1796 1797 aCtor.newInstance(parms); 1798 1799 } catch (java.lang.Throwable exc) {}; 1800 1801 aTestFrame.setVisible(true); 1802 1803 } catch (Throwable exception) { 1804 1805 System.err.println("Exception occurred in main() of java.awt.Frame"); 1806 1807 exception.printStackTrace(System.out); 1808 1809 } 1810 1811} 1812 1813 1820 1821 1822 1823public void windowActivated(java.awt.event.WindowEvent e) { 1824 1825 1827 1829 1831 1833} 1834 1835 1842 1843 1844 1845public void windowClosed(java.awt.event.WindowEvent e) { 1846 1847 1849 1851 1853 1855} 1856 1857 1864 1865 1866 1867public void windowClosing(java.awt.event.WindowEvent e) { 1868 1869 1871 1873 if ((e.getSource() == this) ) { 1874 1875 connEtoC1(e); 1876 1877 } 1878 1879 1881 1883} 1884 1885 1892 1893 1894 1895public void windowDeactivated(java.awt.event.WindowEvent e) { 1896 1897 1899 1901 1903 1905} 1906 1907 1914 1915 1916 1917public void windowDeiconified(java.awt.event.WindowEvent e) { 1918 1919 1921 1923 1925 1927} 1928 1929 1936 1937 1938 1939public void windowIconified(java.awt.event.WindowEvent e) { 1940 1941 1943 1945 1947 1949} 1950 1951 1958 1959 1960 1961public void windowOpened(java.awt.event.WindowEvent e) { 1962 1963 1965 1967 1969 1971} 1972 1973} 1974 1975 | Popular Tags |