KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > poa_monitor > client > TestFrame


1 package demo.poa_monitor.client;
2
3
4
5 /**
6
7  * This type was created in VisualAge.
8
9  */

10
11 public class TestFrame extends java.awt.Frame JavaDoc implements java.awt.event.ActionListener JavaDoc, java.awt.event.AdjustmentListener JavaDoc, java.awt.event.WindowListener JavaDoc {
12
13     private java.awt.Panel JavaDoc ivjButtonPanel = null;
14
15     private java.awt.FlowLayout JavaDoc ivjButtonPanelFlowLayout = null;
16
17     private java.awt.Label JavaDoc ivjComputationLabel = null;
18
19     private java.awt.Panel JavaDoc ivjContentsPane = null;
20
21     private java.awt.Label JavaDoc ivjInvocationLabel = null;
22
23     private java.awt.Label JavaDoc ivjNumberLabel = null;
24
25     private java.awt.TextField JavaDoc ivjNumberTextField = null;
26
27     private java.awt.Label JavaDoc ivjSpeedLabel = null;
28
29     private java.awt.Scrollbar JavaDoc ivjSpeedScrollbar = null;
30
31     private java.awt.Label JavaDoc ivjThreadsLabel = null;
32
33     private java.awt.TextField JavaDoc ivjThreadsTextField = null;
34
35     private java.awt.Button JavaDoc ivjCancelButton = null;
36
37     private java.awt.Button JavaDoc ivjStartButton = null;
38
39     private java.awt.Button JavaDoc ivjStopButton = null;
40
41     private java.awt.Panel JavaDoc ivjWorkPanel = null;
42
43     private java.awt.Label JavaDoc ivjCostLabel = null;
44
45     private java.awt.Scrollbar JavaDoc ivjCostScrollbar = null;
46
47     private java.awt.Label JavaDoc ivjDescriptionLabel = null;
48
49     private java.awt.Label JavaDoc ivjServerLabel = null;
50
51     private java.awt.BorderLayout JavaDoc ivjContentsPaneBorderLayout = null;
52
53     private java.awt.BorderLayout JavaDoc ivjTestFrameBorderLayout = null;
54
55 /**
56
57  * Constructor
58
59  */

60
61 /* WARNING: THIS METHOD WILL BE REGENERATED. */
62
63 public TestFrame() {
64
65     super();
66
67     initialize();
68
69 }
70
71 /**
72
73  * TestFrame constructor comment.
74
75  * @param title java.lang.String
76
77  */

78
79 public TestFrame(String JavaDoc 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 JavaDoc objects, String JavaDoc 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 /**
184
185  * Method to handle events for the ActionListener interface.
186
187  * @param e java.awt.event.ActionEvent
188
189  */

190
191 /* WARNING: THIS METHOD WILL BE REGENERATED. */
192
193 public void actionPerformed(java.awt.event.ActionEvent JavaDoc e) {
194
195     // user code begin {1}
196

197     // user code end
198

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     // user code begin {2}
218

219     // user code end
220

221 }
222
223 /**
224
225  * Method to handle events for the AdjustmentListener interface.
226
227  * @param e java.awt.event.AdjustmentEvent
228
229  */

230
231 /* WARNING: THIS METHOD WILL BE REGENERATED. */
232
233 public void adjustmentValueChanged(java.awt.event.AdjustmentEvent JavaDoc e) {
234
235     // user code begin {1}
236

237     // user code end
238

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     // user code begin {2}
252

253     // user code end
254

255 }
256
257 /**
258
259  * connEtoC1: (TestFrame.window.windowClosing(java.awt.event.WindowEvent) --> TestFrame.dispose()V)
260
261  * @param arg1 java.awt.event.WindowEvent
262
263  */

264
265 /* WARNING: THIS METHOD WILL BE REGENERATED. */
266
267 private void connEtoC1(java.awt.event.WindowEvent JavaDoc arg1) {
268
269     try {
270
271         // user code begin {1}
272

273         // user code end
274

275         this.dispose();
276
277         // user code begin {2}
278

279         // user code end
280

281     } catch (java.lang.Throwable JavaDoc ivjExc) {
282
283         // user code begin {3}
284

285         // user code end
286

287         handleException(ivjExc);
288
289     }
290
291 }
292
293 /**
294
295  * connEtoC2: (CancelButton.action.actionPerformed(java.awt.event.ActionEvent) --> TestFrame._actionCancelButtonPressed()V)
296
297  * @param arg1 java.awt.event.ActionEvent
298
299  */

300
301 /* WARNING: THIS METHOD WILL BE REGENERATED. */
302
303 private void connEtoC2(java.awt.event.ActionEvent JavaDoc arg1) {
304
305     try {
306
307         // user code begin {1}
308

309         // user code end
310

311         this._actionCancelButtonPressed();
312
313         // user code begin {2}
314

315         // user code end
316

317     } catch (java.lang.Throwable JavaDoc ivjExc) {
318
319         // user code begin {3}
320

321         // user code end
322

323         handleException(ivjExc);
324
325     }
326
327 }
328
329 /**
330
331  * connEtoC2: (SpeedScrollbar.adjustment.adjustmentValueChanged(java.awt.event.AdjustmentEvent) --> TestFrame._actionSpeedbarValueChanged(I)V)
332
333  * @param arg1 java.awt.event.AdjustmentEvent
334
335  */

336
337 /* WARNING: THIS METHOD WILL BE REGENERATED. */
338
339 private void connEtoC2(java.awt.event.AdjustmentEvent JavaDoc arg1) {
340
341     try {
342
343         // user code begin {1}
344

345         // user code end
346

347         this._actionSpeedbarValueChanged(getSpeedScrollbar().getValue());
348
349         // user code begin {2}
350

351         // user code end
352

353     } catch (java.lang.Throwable JavaDoc ivjExc) {
354
355         // user code begin {3}
356

357         // user code end
358

359         handleException(ivjExc);
360
361     }
362
363 }
364
365 /**
366
367  * connEtoC3: (StopButton.action.actionPerformed(java.awt.event.ActionEvent) --> TestFrame._actionStopButtonPressed()V)
368
369  * @param arg1 java.awt.event.ActionEvent
370
371  */

372
373 /* WARNING: THIS METHOD WILL BE REGENERATED. */
374
375 private void connEtoC3(java.awt.event.ActionEvent JavaDoc arg1) {
376
377     try {
378
379         // user code begin {1}
380

381         // user code end
382

383         this._actionStopButtonPressed();
384
385         // user code begin {2}
386

387         // user code end
388

389     } catch (java.lang.Throwable JavaDoc ivjExc) {
390
391         // user code begin {3}
392

393         // user code end
394

395         handleException(ivjExc);
396
397     }
398
399 }
400
401 /**
402
403  * connEtoC3: (CostScrollbar.adjustment.adjustmentValueChanged(java.awt.event.AdjustmentEvent) --> TestFrame._actionCostbarValueChanged(I)V)
404
405  * @param arg1 java.awt.event.AdjustmentEvent
406
407  */

408
409 /* WARNING: THIS METHOD WILL BE REGENERATED. */
410
411 private void connEtoC3(java.awt.event.AdjustmentEvent JavaDoc arg1) {
412
413     try {
414
415         // user code begin {1}
416

417         // user code end
418

419         this._actionCostbarValueChanged(getCostScrollbar().getValue());
420
421         // user code begin {2}
422

423         // user code end
424

425     } catch (java.lang.Throwable JavaDoc ivjExc) {
426
427         // user code begin {3}
428

429         // user code end
430

431         handleException(ivjExc);
432
433     }
434
435 }
436
437 /**
438
439  * connEtoC4: (StartButton.action.actionPerformed(java.awt.event.ActionEvent) --> TestFrame._actionStartButtonPressed(Ljava.lang.String;Ljava.lang.String;)V)
440
441  * @param arg1 java.awt.event.ActionEvent
442
443  */

444
445 /* WARNING: THIS METHOD WILL BE REGENERATED. */
446
447 private void connEtoC4(java.awt.event.ActionEvent JavaDoc arg1) {
448
449     try {
450
451         // user code begin {1}
452

453         // user code end
454

455         this._actionStartButtonPressed(getNumberTextField().getText(), getThreadsTextField().getText());
456
457         // user code begin {2}
458

459         // user code end
460

461     } catch (java.lang.Throwable JavaDoc ivjExc) {
462
463         // user code begin {3}
464

465         // user code end
466

467         handleException(ivjExc);
468
469     }
470
471 }
472
473 /**
474
475  * connEtoC5: (StopButton.action.actionPerformed(java.awt.event.ActionEvent) --> TestFrame._actionStopButtonPressed()V)
476
477  * @param arg1 java.awt.event.ActionEvent
478
479  */

480
481 /* WARNING: THIS METHOD WILL BE REGENERATED. */
482
483 private void connEtoC5(java.awt.event.ActionEvent JavaDoc arg1) {
484
485     try {
486
487         // user code begin {1}
488

489         // user code end
490

491         this._actionStopButtonPressed();
492
493         // user code begin {2}
494

495         // user code end
496

497     } catch (java.lang.Throwable JavaDoc ivjExc) {
498
499         // user code begin {3}
500

501         // user code end
502

503         handleException(ivjExc);
504
505     }
506
507 }
508
509 /**
510
511  * connEtoC5: (SpeedScrollbar.adjustment.adjustmentValueChanged(java.awt.event.AdjustmentEvent) --> TestFrame._actionSpeedbarValueChanged(I)V)
512
513  * @param arg1 java.awt.event.AdjustmentEvent
514
515  */

516
517 /* WARNING: THIS METHOD WILL BE REGENERATED. */
518
519 private void connEtoC5(java.awt.event.AdjustmentEvent JavaDoc arg1) {
520
521     try {
522
523         // user code begin {1}
524

525         // user code end
526

527         this._actionSpeedbarValueChanged(getSpeedScrollbar().getValue());
528
529         // user code begin {2}
530

531         // user code end
532

533     } catch (java.lang.Throwable JavaDoc ivjExc) {
534
535         // user code begin {3}
536

537         // user code end
538

539         handleException(ivjExc);
540
541     }
542
543 }
544
545 /**
546
547  * connEtoC6: (CancelButton.action.actionPerformed(java.awt.event.ActionEvent) --> TestFrame._actionCancelButtonPressed()V)
548
549  * @param arg1 java.awt.event.ActionEvent
550
551  */

552
553 /* WARNING: THIS METHOD WILL BE REGENERATED. */
554
555 private void connEtoC6(java.awt.event.ActionEvent JavaDoc arg1) {
556
557     try {
558
559         // user code begin {1}
560

561         // user code end
562

563         this._actionCancelButtonPressed();
564
565         // user code begin {2}
566

567         // user code end
568

569     } catch (java.lang.Throwable JavaDoc ivjExc) {
570
571         // user code begin {3}
572

573         // user code end
574

575         handleException(ivjExc);
576
577     }
578
579 }
580
581 /**
582
583  * connEtoC6: (CostsScrollbar.adjustment.adjustmentValueChanged(java.awt.event.AdjustmentEvent) --> TestFrame._actionCostsbarValueChanged(I)V)
584
585  * @param arg1 java.awt.event.AdjustmentEvent
586
587  */

588
589 /* WARNING: THIS METHOD WILL BE REGENERATED. */
590
591 private void connEtoC6(java.awt.event.AdjustmentEvent JavaDoc arg1) {
592
593     try {
594
595         // user code begin {1}
596

597         // user code end
598

599         this._actionCostbarValueChanged(getCostScrollbar().getValue());
600
601         // user code begin {2}
602

603         // user code end
604

605     } catch (java.lang.Throwable JavaDoc ivjExc) {
606
607         // user code begin {3}
608

609         // user code end
610

611         handleException(ivjExc);
612
613     }
614
615 }
616
617 /**
618
619  * Return the ButtonPanel property value.
620
621  * @return java.awt.Panel
622
623  */

624
625 /* WARNING: THIS METHOD WILL BE REGENERATED. */
626
627 private java.awt.Panel JavaDoc getButtonPanel() {
628
629     if (ivjButtonPanel == null) {
630
631         try {
632
633             ivjButtonPanel = new java.awt.Panel JavaDoc();
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             // user code begin {1}
648

649             // user code end
650

651         } catch (java.lang.Throwable JavaDoc ivjExc) {
652
653             // user code begin {2}
654

655             // user code end
656

657             handleException(ivjExc);
658
659         }
660
661     };
662
663     return ivjButtonPanel;
664
665 }
666
667 /**
668
669  * Return the ButtonPanelFlowLayout property value.
670
671  * @return java.awt.FlowLayout
672
673  */

674
675 /* WARNING: THIS METHOD WILL BE REGENERATED. */
676
677 private java.awt.FlowLayout JavaDoc getButtonPanelFlowLayout() {
678
679     java.awt.FlowLayout JavaDoc ivjButtonPanelFlowLayout = null;
680
681     try {
682
683         /* Create part */
684
685         ivjButtonPanelFlowLayout = new java.awt.FlowLayout JavaDoc();
686
687         ivjButtonPanelFlowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
688
689         ivjButtonPanelFlowLayout.setVgap(5);
690
691         ivjButtonPanelFlowLayout.setHgap(10);
692
693     } catch (java.lang.Throwable JavaDoc ivjExc) {
694
695         handleException(ivjExc);
696
697     };
698
699     return ivjButtonPanelFlowLayout;
700
701 }
702
703 /**
704
705  * Return the Button1 property value.
706
707  * @return java.awt.Button
708
709  */

710
711 /* WARNING: THIS METHOD WILL BE REGENERATED. */
712
713 private java.awt.Button JavaDoc getCancelButton() {
714
715     if (ivjCancelButton == null) {
716
717         try {
718
719             ivjCancelButton = new java.awt.Button JavaDoc();
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             // user code begin {1}
730

731             // user code end
732

733         } catch (java.lang.Throwable JavaDoc ivjExc) {
734
735             // user code begin {2}
736

737             // user code end
738

739             handleException(ivjExc);
740
741         }
742
743     };
744
745     return ivjCancelButton;
746
747 }
748
749 /**
750
751  * Return the ComputationLabel property value.
752
753  * @return java.awt.Label
754
755  */

756
757 /* WARNING: THIS METHOD WILL BE REGENERATED. */
758
759 private java.awt.Label JavaDoc getComputationLabel() {
760
761     if (ivjComputationLabel == null) {
762
763         try {
764
765             ivjComputationLabel = new java.awt.Label JavaDoc();
766
767             ivjComputationLabel.setName("ComputationLabel");
768
769             ivjComputationLabel.setLocation(new java.awt.Point JavaDoc(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 JavaDoc(130, 12));
776
777             ivjComputationLabel.setForeground(java.awt.Color.black);
778
779             ivjComputationLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 10));
780
781             ivjComputationLabel.setBounds(new java.awt.Rectangle JavaDoc(20, 185, 130, 12));
782
783             ivjComputationLabel.setAlignment(java.awt.Label.LEFT);
784
785             ivjComputationLabel.setBounds(20, 185, 130, 12);
786
787             // user code begin {1}
788

789             // user code end
790

791         } catch (java.lang.Throwable JavaDoc ivjExc) {
792
793             // user code begin {2}
794

795             // user code end
796

797             handleException(ivjExc);
798
799         }
800
801     };
802
803     return ivjComputationLabel;
804
805 }
806
807 /**
808
809  * Return the ContentsPane property value.
810
811  * @return java.awt.Panel
812
813  */

814
815 /* WARNING: THIS METHOD WILL BE REGENERATED. */
816
817 private java.awt.Panel JavaDoc getContentsPane() {
818
819     if (ivjContentsPane == null) {
820
821         try {
822
823             ivjContentsPane = new java.awt.Panel JavaDoc();
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             // user code begin {1}
836

837             // user code end
838

839         } catch (java.lang.Throwable JavaDoc ivjExc) {
840
841             // user code begin {2}
842

843             // user code end
844

845             handleException(ivjExc);
846
847         }
848
849     };
850
851     return ivjContentsPane;
852
853 }
854
855 /**
856
857  * Return the ContentsPaneBorderLayout property value.
858
859  * @return java.awt.BorderLayout
860
861  */

862
863 /* WARNING: THIS METHOD WILL BE REGENERATED. */
864
865 private java.awt.BorderLayout JavaDoc getContentsPaneBorderLayout() {
866
867     java.awt.BorderLayout JavaDoc ivjContentsPaneBorderLayout = null;
868
869     try {
870
871         /* Create part */
872
873         ivjContentsPaneBorderLayout = new java.awt.BorderLayout JavaDoc();
874
875         ivjContentsPaneBorderLayout.setVgap(0);
876
877         ivjContentsPaneBorderLayout.setHgap(0);
878
879     } catch (java.lang.Throwable JavaDoc ivjExc) {
880
881         handleException(ivjExc);
882
883     };
884
885     return ivjContentsPaneBorderLayout;
886
887 }
888
889 /**
890
891  * Return the CostsLabel property value.
892
893  * @return java.awt.Label
894
895  */

896
897 /* WARNING: THIS METHOD WILL BE REGENERATED. */
898
899 private java.awt.Label JavaDoc getCostLabel() {
900
901     if (ivjCostLabel == null) {
902
903         try {
904
905             ivjCostLabel = new java.awt.Label JavaDoc();
906
907             ivjCostLabel.setName("CostLabel");
908
909             ivjCostLabel.setLocation(new java.awt.Point JavaDoc(170, 197));
910
911             ivjCostLabel.setText("no cost");
912
913             ivjCostLabel.setBackground(java.awt.SystemColor.control);
914
915             ivjCostLabel.setSize(new java.awt.Dimension JavaDoc(80, 23));
916
917             ivjCostLabel.setForeground(java.awt.Color.red);
918
919             ivjCostLabel.setFont(new java.awt.Font JavaDoc("dialog", 1, 12));
920
921             ivjCostLabel.setBounds(new java.awt.Rectangle JavaDoc(170, 197, 80, 23));
922
923             ivjCostLabel.setAlignment(2);
924
925             ivjCostLabel.setBounds(150, 197, 100, 23);
926
927             // user code begin {1}
928

929             // user code end
930

931         } catch (java.lang.Throwable JavaDoc ivjExc) {
932
933             // user code begin {2}
934

935             // user code end
936

937             handleException(ivjExc);
938
939         }
940
941     };
942
943     return ivjCostLabel;
944
945 }
946
947 /**
948
949  * Return the CostsScrollbar property value.
950
951  * @return java.awt.Scrollbar
952
953  */

954
955 /* WARNING: THIS METHOD WILL BE REGENERATED. */
956
957 private java.awt.Scrollbar JavaDoc getCostScrollbar() {
958
959     if (ivjCostScrollbar == null) {
960
961         try {
962
963             ivjCostScrollbar = new java.awt.Scrollbar JavaDoc();
964
965             ivjCostScrollbar.setName("CostScrollbar");
966
967             ivjCostScrollbar.setLocation(new java.awt.Point JavaDoc(20, 200));
968
969             ivjCostScrollbar.setSize(new java.awt.Dimension JavaDoc(130, 18));
970
971             ivjCostScrollbar.setBounds(new java.awt.Rectangle JavaDoc(20, 200, 130, 18));
972
973             ivjCostScrollbar.setBounds(20, 200, 120, 18);
974
975             ivjCostScrollbar.setOrientation(java.awt.Scrollbar.HORIZONTAL);
976
977             // user code begin {1}
978

979             // user code end
980

981         } catch (java.lang.Throwable JavaDoc ivjExc) {
982
983             // user code begin {2}
984

985             // user code end
986

987             handleException(ivjExc);
988
989         }
990
991     };
992
993     return ivjCostScrollbar;
994
995 }
996
997 /**
998
999  * Return the DescriptionLabel property value.
1000
1001 * @return java.awt.Label
1002
1003 */

1004
1005/* WARNING: THIS METHOD WILL BE REGENERATED. */
1006
1007private java.awt.Label JavaDoc getDescriptionLabel() {
1008
1009    if (ivjDescriptionLabel == null) {
1010
1011        try {
1012
1013            ivjDescriptionLabel = new java.awt.Label JavaDoc();
1014
1015            ivjDescriptionLabel.setName("DescriptionLabel");
1016
1017            ivjDescriptionLabel.setLocation(new java.awt.Point JavaDoc(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 JavaDoc(260, 23));
1024
1025            ivjDescriptionLabel.setForeground(java.awt.Color.black);
1026
1027            ivjDescriptionLabel.setFont(new java.awt.Font JavaDoc("dialog", 3, 12));
1028
1029            ivjDescriptionLabel.setBounds(new java.awt.Rectangle JavaDoc(10, 35, 260, 23));
1030
1031            ivjDescriptionLabel.setAlignment(1);
1032
1033            ivjDescriptionLabel.setBounds(10, 35, 260, 23);
1034
1035            // user code begin {1}
1036

1037            // user code end
1038

1039        } catch (java.lang.Throwable JavaDoc ivjExc) {
1040
1041            // user code begin {2}
1042

1043            // user code end
1044

1045            handleException(ivjExc);
1046
1047        }
1048
1049    };
1050
1051    return ivjDescriptionLabel;
1052
1053}
1054
1055/**
1056
1057 * Return the InvocationLabel property value.
1058
1059 * @return java.awt.Label
1060
1061 */

1062
1063/* WARNING: THIS METHOD WILL BE REGENERATED. */
1064
1065private java.awt.Label JavaDoc getInvocationLabel() {
1066
1067    if (ivjInvocationLabel == null) {
1068
1069        try {
1070
1071            ivjInvocationLabel = new java.awt.Label JavaDoc();
1072
1073            ivjInvocationLabel.setName("InvocationLabel");
1074
1075            ivjInvocationLabel.setLocation(new java.awt.Point JavaDoc(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 JavaDoc(130, 12));
1082
1083            ivjInvocationLabel.setForeground(java.awt.Color.black);
1084
1085            ivjInvocationLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 10));
1086
1087            ivjInvocationLabel.setBounds(new java.awt.Rectangle JavaDoc(20, 145, 130, 12));
1088
1089            ivjInvocationLabel.setAlignment(java.awt.Label.LEFT);
1090
1091            ivjInvocationLabel.setBounds(20, 145, 130, 12);
1092
1093            // user code begin {1}
1094

1095            // user code end
1096

1097        } catch (java.lang.Throwable JavaDoc ivjExc) {
1098
1099            // user code begin {2}
1100

1101            // user code end
1102

1103            handleException(ivjExc);
1104
1105        }
1106
1107    };
1108
1109    return ivjInvocationLabel;
1110
1111}
1112
1113/**
1114
1115 * Return the NumberLabel property value.
1116
1117 * @return java.awt.Label
1118
1119 */

1120
1121/* WARNING: THIS METHOD WILL BE REGENERATED. */
1122
1123private java.awt.Label JavaDoc getNumberLabel() {
1124
1125    if (ivjNumberLabel == null) {
1126
1127        try {
1128
1129            ivjNumberLabel = new java.awt.Label JavaDoc();
1130
1131            ivjNumberLabel.setName("NumberLabel");
1132
1133            ivjNumberLabel.setLocation(new java.awt.Point JavaDoc(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 JavaDoc(110, 23));
1140
1141            ivjNumberLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 12));
1142
1143            ivjNumberLabel.setBounds(new java.awt.Rectangle JavaDoc(20, 70, 110, 23));
1144
1145            ivjNumberLabel.setBounds(20, 70, 110, 23);
1146
1147            // user code begin {1}
1148

1149            // user code end
1150

1151        } catch (java.lang.Throwable JavaDoc ivjExc) {
1152
1153            // user code begin {2}
1154

1155            // user code end
1156

1157            handleException(ivjExc);
1158
1159        }
1160
1161    };
1162
1163    return ivjNumberLabel;
1164
1165}
1166
1167/**
1168
1169 * Return the NumberTextField property value.
1170
1171 * @return java.awt.TextField
1172
1173 */

1174
1175/* WARNING: THIS METHOD WILL BE REGENERATED. */
1176
1177private java.awt.TextField JavaDoc getNumberTextField() {
1178
1179    if (ivjNumberTextField == null) {
1180
1181        try {
1182
1183            ivjNumberTextField = new java.awt.TextField JavaDoc();
1184
1185            ivjNumberTextField.setName("NumberTextField");
1186
1187            ivjNumberTextField.setLocation(new java.awt.Point JavaDoc(170, 70));
1188
1189            ivjNumberTextField.setText("1");
1190
1191            ivjNumberTextField.setBackground(java.awt.Color.white);
1192
1193            ivjNumberTextField.setSize(new java.awt.Dimension JavaDoc(80, 23));
1194
1195            ivjNumberTextField.setBounds(new java.awt.Rectangle JavaDoc(170, 70, 80, 23));
1196
1197            ivjNumberTextField.setBounds(170, 66, 80, 30);
1198
1199            // user code begin {1}
1200

1201            // user code end
1202

1203        } catch (java.lang.Throwable JavaDoc ivjExc) {
1204
1205            // user code begin {2}
1206

1207            // user code end
1208

1209            handleException(ivjExc);
1210
1211        }
1212
1213    };
1214
1215    return ivjNumberTextField;
1216
1217}
1218
1219/**
1220
1221 * Return the ServerLabel property value.
1222
1223 * @return java.awt.Label
1224
1225 */

1226
1227/* WARNING: THIS METHOD WILL BE REGENERATED. */
1228
1229private java.awt.Label JavaDoc getServerLabel() {
1230
1231    if (ivjServerLabel == null) {
1232
1233        try {
1234
1235            ivjServerLabel = new java.awt.Label JavaDoc();
1236
1237            ivjServerLabel.setName("ServerLabel");
1238
1239            ivjServerLabel.setLocation(new java.awt.Point JavaDoc(20, 20));
1240
1241            ivjServerLabel.setText("Server description:");
1242
1243            ivjServerLabel.setBackground(java.awt.SystemColor.control);
1244
1245            ivjServerLabel.setSize(new java.awt.Dimension JavaDoc(240, 12));
1246
1247            ivjServerLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 10));
1248
1249            ivjServerLabel.setBounds(new java.awt.Rectangle JavaDoc(20, 20, 240, 12));
1250
1251            ivjServerLabel.setAlignment(1);
1252
1253            ivjServerLabel.setBounds(20, 20, 240, 12);
1254
1255            // user code begin {1}
1256

1257            // user code end
1258

1259        } catch (java.lang.Throwable JavaDoc ivjExc) {
1260
1261            // user code begin {2}
1262

1263            // user code end
1264

1265            handleException(ivjExc);
1266
1267        }
1268
1269    };
1270
1271    return ivjServerLabel;
1272
1273}
1274
1275/**
1276
1277 * Return the SpeedLabel property value.
1278
1279 * @return java.awt.Label
1280
1281 */

1282
1283/* WARNING: THIS METHOD WILL BE REGENERATED. */
1284
1285private java.awt.Label JavaDoc getSpeedLabel() {
1286
1287    if (ivjSpeedLabel == null) {
1288
1289        try {
1290
1291            ivjSpeedLabel = new java.awt.Label JavaDoc();
1292
1293            ivjSpeedLabel.setName("SpeedLabel");
1294
1295            ivjSpeedLabel.setLocation(new java.awt.Point JavaDoc(170, 157));
1296
1297            ivjSpeedLabel.setText("no delay");
1298
1299            ivjSpeedLabel.setBackground(java.awt.SystemColor.control);
1300
1301            ivjSpeedLabel.setSize(new java.awt.Dimension JavaDoc(80, 23));
1302
1303            ivjSpeedLabel.setForeground(java.awt.Color.red);
1304
1305            ivjSpeedLabel.setFont(new java.awt.Font JavaDoc("dialog", 1, 12));
1306
1307            ivjSpeedLabel.setBounds(new java.awt.Rectangle JavaDoc(170, 157, 80, 23));
1308
1309            ivjSpeedLabel.setAlignment(2);
1310
1311            ivjSpeedLabel.setBounds(150, 157, 100, 23);
1312
1313            // user code begin {1}
1314

1315            // user code end
1316

1317        } catch (java.lang.Throwable JavaDoc ivjExc) {
1318
1319            // user code begin {2}
1320

1321            // user code end
1322

1323            handleException(ivjExc);
1324
1325        }
1326
1327    };
1328
1329    return ivjSpeedLabel;
1330
1331}
1332
1333/**
1334
1335 * Return the SpeedScrollbar property value.
1336
1337 * @return java.awt.Scrollbar
1338
1339 */

1340
1341/* WARNING: THIS METHOD WILL BE REGENERATED. */
1342
1343private java.awt.Scrollbar JavaDoc getSpeedScrollbar() {
1344
1345    if (ivjSpeedScrollbar == null) {
1346
1347        try {
1348
1349            ivjSpeedScrollbar = new java.awt.Scrollbar JavaDoc();
1350
1351            ivjSpeedScrollbar.setName("SpeedScrollbar");
1352
1353            ivjSpeedScrollbar.setLocation(new java.awt.Point JavaDoc(20, 160));
1354
1355            ivjSpeedScrollbar.setSize(new java.awt.Dimension JavaDoc(130, 18));
1356
1357            ivjSpeedScrollbar.setBounds(new java.awt.Rectangle JavaDoc(20, 160, 130, 18));
1358
1359            ivjSpeedScrollbar.setBounds(20, 160, 120, 18);
1360
1361            ivjSpeedScrollbar.setOrientation(java.awt.Scrollbar.HORIZONTAL);
1362
1363            // user code begin {1}
1364

1365            // user code end
1366

1367        } catch (java.lang.Throwable JavaDoc ivjExc) {
1368
1369            // user code begin {2}
1370

1371            // user code end
1372

1373            handleException(ivjExc);
1374
1375        }
1376
1377    };
1378
1379    return ivjSpeedScrollbar;
1380
1381}
1382
1383/**
1384
1385 * Return the Button3 property value.
1386
1387 * @return java.awt.Button
1388
1389 */

1390
1391/* WARNING: THIS METHOD WILL BE REGENERATED. */
1392
1393private java.awt.Button JavaDoc getStartButton() {
1394
1395    if (ivjStartButton == null) {
1396
1397        try {
1398
1399            ivjStartButton = new java.awt.Button JavaDoc();
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            // user code begin {1}
1410

1411            // user code end
1412

1413        } catch (java.lang.Throwable JavaDoc ivjExc) {
1414
1415            // user code begin {2}
1416

1417            // user code end
1418

1419            handleException(ivjExc);
1420
1421        }
1422
1423    };
1424
1425    return ivjStartButton;
1426
1427}
1428
1429/**
1430
1431 * Return the Button2 property value.
1432
1433 * @return java.awt.Button
1434
1435 */

1436
1437/* WARNING: THIS METHOD WILL BE REGENERATED. */
1438
1439private java.awt.Button JavaDoc getStopButton() {
1440
1441    if (ivjStopButton == null) {
1442
1443        try {
1444
1445            ivjStopButton = new java.awt.Button JavaDoc();
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            // user code begin {1}
1456

1457            // user code end
1458

1459        } catch (java.lang.Throwable JavaDoc ivjExc) {
1460
1461            // user code begin {2}
1462

1463            // user code end
1464

1465            handleException(ivjExc);
1466
1467        }
1468
1469    };
1470
1471    return ivjStopButton;
1472
1473}
1474
1475/**
1476
1477 * Return the TestFrameBorderLayout property value.
1478
1479 * @return java.awt.BorderLayout
1480
1481 */

1482
1483/* WARNING: THIS METHOD WILL BE REGENERATED. */
1484
1485private java.awt.BorderLayout JavaDoc getTestFrameBorderLayout() {
1486
1487    java.awt.BorderLayout JavaDoc ivjTestFrameBorderLayout = null;
1488
1489    try {
1490
1491        /* Create part */
1492
1493        ivjTestFrameBorderLayout = new java.awt.BorderLayout JavaDoc();
1494
1495        ivjTestFrameBorderLayout.setVgap(0);
1496
1497        ivjTestFrameBorderLayout.setHgap(0);
1498
1499    } catch (java.lang.Throwable JavaDoc ivjExc) {
1500
1501        handleException(ivjExc);
1502
1503    };
1504
1505    return ivjTestFrameBorderLayout;
1506
1507}
1508
1509/**
1510
1511 * Return the ThreadsLabel property value.
1512
1513 * @return java.awt.Label
1514
1515 */

1516
1517/* WARNING: THIS METHOD WILL BE REGENERATED. */
1518
1519private java.awt.Label JavaDoc getThreadsLabel() {
1520
1521    if (ivjThreadsLabel == null) {
1522
1523        try {
1524
1525            ivjThreadsLabel = new java.awt.Label JavaDoc();
1526
1527            ivjThreadsLabel.setName("ThreadsLabel");
1528
1529            ivjThreadsLabel.setLocation(new java.awt.Point JavaDoc(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 JavaDoc(110, 23));
1536
1537            ivjThreadsLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 12));
1538
1539            ivjThreadsLabel.setBounds(new java.awt.Rectangle JavaDoc(20, 105, 110, 23));
1540
1541            ivjThreadsLabel.setBounds(20, 105, 110, 23);
1542
1543            // user code begin {1}
1544

1545            // user code end
1546

1547        } catch (java.lang.Throwable JavaDoc ivjExc) {
1548
1549            // user code begin {2}
1550

1551            // user code end
1552

1553            handleException(ivjExc);
1554
1555        }
1556
1557    };
1558
1559    return ivjThreadsLabel;
1560
1561}
1562
1563/**
1564
1565 * Return the ThreadsTextField property value.
1566
1567 * @return java.awt.TextField
1568
1569 */

1570
1571/* WARNING: THIS METHOD WILL BE REGENERATED. */
1572
1573private java.awt.TextField JavaDoc getThreadsTextField() {
1574
1575    if (ivjThreadsTextField == null) {
1576
1577        try {
1578
1579            ivjThreadsTextField = new java.awt.TextField JavaDoc();
1580
1581            ivjThreadsTextField.setName("ThreadsTextField");
1582
1583            ivjThreadsTextField.setLocation(new java.awt.Point JavaDoc(170, 105));
1584
1585            ivjThreadsTextField.setText("1");
1586
1587            ivjThreadsTextField.setBackground(new java.awt.Color JavaDoc(255,255,255));
1588
1589            ivjThreadsTextField.setSize(new java.awt.Dimension JavaDoc(80, 23));
1590
1591            ivjThreadsTextField.setBounds(new java.awt.Rectangle JavaDoc(170, 105, 80, 23));
1592
1593            ivjThreadsTextField.setBounds(170, 101, 80, 30);
1594
1595            // user code begin {1}
1596

1597            // user code end
1598

1599        } catch (java.lang.Throwable JavaDoc ivjExc) {
1600
1601            // user code begin {2}
1602

1603            // user code end
1604

1605            handleException(ivjExc);
1606
1607        }
1608
1609    };
1610
1611    return ivjThreadsTextField;
1612
1613}
1614
1615/**
1616
1617 * Return the ContentsPane property value.
1618
1619 * @return java.awt.Panel
1620
1621 */

1622
1623/* WARNING: THIS METHOD WILL BE REGENERATED. */
1624
1625private java.awt.Panel JavaDoc getWorkPanel() {
1626
1627    if (ivjWorkPanel == null) {
1628
1629        try {
1630
1631            ivjWorkPanel = new java.awt.Panel JavaDoc();
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            // user code begin {1}
1664

1665            // user code end
1666

1667        } catch (java.lang.Throwable JavaDoc ivjExc) {
1668
1669            // user code begin {2}
1670

1671            // user code end
1672

1673            handleException(ivjExc);
1674
1675        }
1676
1677    };
1678
1679    return ivjWorkPanel;
1680
1681}
1682
1683/**
1684
1685 * Called whenever the part throws an exception.
1686
1687 * @param exception java.lang.Throwable
1688
1689 */

1690
1691private void handleException(Throwable JavaDoc exception) {
1692
1693
1694
1695    /* Uncomment the following lines to print uncaught exceptions to stdout */
1696
1697    // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
1698

1699    // exception.printStackTrace(System.out);
1700

1701}
1702
1703/**
1704
1705 * Initializes connections
1706
1707 */

1708
1709/* WARNING: THIS METHOD WILL BE REGENERATED. */
1710
1711private void initConnections() {
1712
1713    // user code begin {1}
1714

1715    // user code end
1716

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/**
1732
1733 * Initialize the class.
1734
1735 */

1736
1737/* WARNING: THIS METHOD WILL BE REGENERATED. */
1738
1739private void initialize() {
1740
1741    // user code begin {1}
1742

1743    // user code end
1744

1745    setName("TestFrame");
1746
1747    setLayout(getTestFrameBorderLayout());
1748
1749    setBackground(java.awt.SystemColor.control);
1750
1751    setSize(new java.awt.Dimension JavaDoc(280, 310));
1752
1753    setBounds(new java.awt.Rectangle JavaDoc(0, 0, 280, 310));
1754
1755    setSize(280, 310);
1756
1757    setTitle("Test Client");
1758
1759    add(getContentsPane(), "Center");
1760
1761    initConnections();
1762
1763    // user code begin {2}
1764

1765    getDescriptionLabel().setText(Client.serverDescription);
1766
1767    // user code end
1768

1769}
1770
1771/**
1772
1773 * main entrypoint - starts the part when it is run as an application
1774
1775 * @param args java.lang.String[]
1776
1777 */

1778
1779public static void main(java.lang.String JavaDoc[] args) {
1780
1781    try {
1782
1783        TestFrame aTestFrame;
1784
1785        aTestFrame = new TestFrame();
1786
1787        try {
1788
1789            Class JavaDoc aCloserClass = Class.forName("com.ibm.uvm.abt.edit.WindowCloser");
1790
1791            Class JavaDoc parmTypes[] = { java.awt.Window JavaDoc.class };
1792
1793            Object JavaDoc parms[] = { aTestFrame };
1794
1795            java.lang.reflect.Constructor JavaDoc aCtor = aCloserClass.getConstructor(parmTypes);
1796
1797            aCtor.newInstance(parms);
1798
1799        } catch (java.lang.Throwable JavaDoc exc) {};
1800
1801        aTestFrame.setVisible(true);
1802
1803    } catch (Throwable JavaDoc 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/**
1814
1815 * Method to handle events for the WindowListener interface.
1816
1817 * @param e java.awt.event.WindowEvent
1818
1819 */

1820
1821/* WARNING: THIS METHOD WILL BE REGENERATED. */
1822
1823public void windowActivated(java.awt.event.WindowEvent JavaDoc e) {
1824
1825    // user code begin {1}
1826

1827    // user code end
1828

1829    // user code begin {2}
1830

1831    // user code end
1832

1833}
1834
1835/**
1836
1837 * Method to handle events for the WindowListener interface.
1838
1839 * @param e java.awt.event.WindowEvent
1840
1841 */

1842
1843/* WARNING: THIS METHOD WILL BE REGENERATED. */
1844
1845public void windowClosed(java.awt.event.WindowEvent JavaDoc e) {
1846
1847    // user code begin {1}
1848

1849    // user code end
1850

1851    // user code begin {2}
1852

1853    // user code end
1854

1855}
1856
1857/**
1858
1859 * Method to handle events for the WindowListener interface.
1860
1861 * @param e java.awt.event.WindowEvent
1862
1863 */

1864
1865/* WARNING: THIS METHOD WILL BE REGENERATED. */
1866
1867public void windowClosing(java.awt.event.WindowEvent JavaDoc e) {
1868
1869    // user code begin {1}
1870

1871    // user code end
1872

1873    if ((e.getSource() == this) ) {
1874
1875        connEtoC1(e);
1876
1877    }
1878
1879    // user code begin {2}
1880

1881    // user code end
1882

1883}
1884
1885/**
1886
1887 * Method to handle events for the WindowListener interface.
1888
1889 * @param e java.awt.event.WindowEvent
1890
1891 */

1892
1893/* WARNING: THIS METHOD WILL BE REGENERATED. */
1894
1895public void windowDeactivated(java.awt.event.WindowEvent JavaDoc e) {
1896
1897    // user code begin {1}
1898

1899    // user code end
1900

1901    // user code begin {2}
1902

1903    // user code end
1904

1905}
1906
1907/**
1908
1909 * Method to handle events for the WindowListener interface.
1910
1911 * @param e java.awt.event.WindowEvent
1912
1913 */

1914
1915/* WARNING: THIS METHOD WILL BE REGENERATED. */
1916
1917public void windowDeiconified(java.awt.event.WindowEvent JavaDoc e) {
1918
1919    // user code begin {1}
1920

1921    // user code end
1922

1923    // user code begin {2}
1924

1925    // user code end
1926

1927}
1928
1929/**
1930
1931 * Method to handle events for the WindowListener interface.
1932
1933 * @param e java.awt.event.WindowEvent
1934
1935 */

1936
1937/* WARNING: THIS METHOD WILL BE REGENERATED. */
1938
1939public void windowIconified(java.awt.event.WindowEvent JavaDoc e) {
1940
1941    // user code begin {1}
1942

1943    // user code end
1944

1945    // user code begin {2}
1946

1947    // user code end
1948

1949}
1950
1951/**
1952
1953 * Method to handle events for the WindowListener interface.
1954
1955 * @param e java.awt.event.WindowEvent
1956
1957 */

1958
1959/* WARNING: THIS METHOD WILL BE REGENERATED. */
1960
1961public void windowOpened(java.awt.event.WindowEvent JavaDoc e) {
1962
1963    // user code begin {1}
1964

1965    // user code end
1966

1967    // user code begin {2}
1968

1969    // user code end
1970

1971}
1972
1973}
1974
1975
Popular Tags