1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
|
<html>
<head>
<title>
Handbuch der Java-Programmierung, 5. Auflage
</title>
</head>
<body>
<a name="startofbody"></a>
<script language="JavaScript" src="hjp4lib.js">
</script>
<script language="JavaScript">
installKbdHandler("97,#startofbody;101,#endofbody;116,cover.html;122,k100003.html;115,search.html;105,index.html;100,JDKDOCS;112,APIDOCS;104,k100279.html;106,k100282.html;107,k100284.html;108,k100287.html");
</script>
<table border=0 cellpadding=0 cellspacing=1 width="100%">
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="cover.html"> Titel </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100003.html"> Inhalt </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="search.html"> Suchen </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="index.html"> Index </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/index.html" onClick="this.href=getDocIndex()"> DOC </a>
<td align="right">Handbuch der Java-Programmierung, 5. Auflage
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100279.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100282.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100284.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100287.html"> >> </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/api/index.html" onClick="this.href=getApiIndex()"> API </a>
<td align="right">Kapitel 44 - Beans
</table>
<hr>
<!-- Section -->
<a name="sectlevel2id044004"></a>
<h2>44.4 Bean-Ereignisse </h2>
<hr>
<ul>
<li><a href="k100283.html#sectlevel2id044004">44.4 Bean-Ereignisse</a>
<ul>
<li><a href="k100283.html#sectlevel3id044004001">44.4.1 Bound Properties</a>
<li><a href="k100283.html#sectlevel3id044004002">44.4.2 Constrained Properties</a>
<li><a href="k100283.html#sectlevel3id044004003">44.4.3 Anwendungsbeispiel</a>
</ul>
</ul>
<hr>
<p>
Um die Kommunikation zwischen Beans zu vereinfachen und zu vereinheitlichen,
sieht die Beans-Spezifikation einige Techniken vor, mit denen Beans
untereinander kommunizieren können. Die wichtigste von ihnen
ist die Möglichkeit, Nachrichten zu versenden, wenn sich eine
bestimmte Eigenschaft der Bean geändert hat. Das dabei angewendete
Schema entspricht genau dem Delegation Based Event Handling, das in
<a href="k100180.html#kapiteleventhandling">Kapitel 28</a> erläutert
wurde und das auch alle anderen Dialogelemente zur Kommunikation mit
anderen Komponenten verwenden.
<!-- Section -->
<a name="sectlevel3id044004001"></a>
<h3>44.4.1 Bound Properties </h3>
<p>
Eigenschaften, bei deren Veränderung Ereignisse ausgesandt werden,
bezeichnet man auch als <i>gebundene Eigenschaften</i> <a name="ixa103280"></a>
(<a name="ixa103281"><i>Bound Properties</i></a>). Nicht alle Eigenschaften
müssen gebunden sein. Sie sollten es dann sein, wenn die Bean
anderen Objekten die Möglichkeit geben will, auf Änderungen
des Ereignisses direkt und in definierter (und für einen GUI-Designer
erkennbaren) Weise zu reagieren.
<p>
Zusätzlich zu den bereits bekannten Ereignistypen definiert die
Bean-Architektur dazu eine neue Ereignisklasse <a name="ixa103282"><a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a></a>,
die im Paket <a name="ixa103283"><a href="index_j.html#ixb100594"><font color=#000080><tt>java.beans</tt></font></a></a>
untergebracht ist. Sie ist aus <a name="ixa103284"><a href="index_e.html#ixb101400"><font color=#000080><tt>EventObject</tt></font></a></a>
abgeleitet und stellt unter anderem folgende Methoden zur Verfügung:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public String getPropertyName()
public Object getNewValue()
public Object getOldValue()
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/beans/PropertyChangeEvent.html" onClick="this.href=getApiDoc('java.beans.PropertyChangeEvent')"><font color="#660066" size=-1>java.beans.PropertyChangeEvent</font></a></td>
</tr>
</table>
<p>
Mit <a name="ixa103285"><a href="index_g.html#ixb102427"><font color=#000080><tt>getPropertyName</tt></font></a></a>
kann der Name der veränderten Eigenschaft ermittelt werden. <a name="ixa103286"><a href="index_g.html#ixb102428"><font color=#000080><tt>getNewValue</tt></font></a></a>
liefert ihren neuen Wert und <a name="ixa103287"><a href="index_g.html#ixb102429"><font color=#000080><tt>getOldValue</tt></font></a></a>
den Wert, den sie vor der Änderung hatte. Die Werte werden stets
als Objekttyp zurückgegeben. Primitive Typen werden in ihre korrespondierenden
Wrapper-Klassen verpackt (siehe <a href="k100066.html#wrapperklassen">Abschnitt 10.2</a>).
<p>
Eine Bean erzeugt immer dann ein <a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a>
und versendet es an alle registrierten Listener, wenn sich der Zustand
einer <i>gebundenen Eigenschaft</i> verändert hat. Ein Listener
muss das Interface <a name="ixa103288"><a href="index_p.html#ixb102430"><font color=#000080><tt>PropertyChangeListener</tt></font></a></a>
implementieren. Es enthält nur eine Methode:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
void propertyChange(PropertyChangeEvent evt)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/beans/PropertyChangeListener.html" onClick="this.href=getApiDoc('java.beans.PropertyChangeListener')"><font color="#660066" size=-1>java.beans.PropertyChangeListener</font></a></td>
</tr>
</table>
<p>
Verändert sich die gebundene Eigenschaft, erzeugt die Bean ein
<a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a>
mit dem neuen und dem alten Wert und ruft bei allen registrierten
Listenern <a name="ixa103289"><a href="index_p.html#ixb102431"><font color=#000080><tt>propertyChange</tt></font></a></a>
auf. Die Registrierung bzw. Deregistrierung von Listenern erfolgt
mit den Methoden <a name="ixa103290"><a href="index_a.html#ixb102432"><font color=#000080><tt>addPropertyChangeListener</tt></font></a></a>
und <a name="ixa103291"><a href="index_r.html#ixb102433"><font color=#000080><tt>removePropertyChangeListener</tt></font></a></a>,
die beide einen <a href="index_p.html#ixb102430"><font color=#000080><tt>PropertyChangeListener</tt></font></a>
als Argument erwarten.
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr>
<td width=1 align=left valign=top bgcolor="#000077"><img src="trp1_1.gif"></td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top width=1000>
<p>
Damit ein GUI-Designer erkennen kann, dass eine Bean gebundene Eigenschaften
besitzt, müssen die Methoden zum Registrieren und Deregistrieren
exakt die hier gezeigten Namen- und Parameterkonventionen einhalten.
Sie sind ebenso Bestandteil der Designkonventionen von Beans wie die
in den vorigen Abschnitten erwähnten getter- und setter-Methoden.</td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top>
<table border=0 cellspacing=0 cellpadding=1 width=100% bgcolor="#000077">
<tr>
<td><font color="#FFFFFF"> Hinweis </font></td>
</tr>
</table>
</td>
<td width=1 align=left valign=top bgcolor="#000077"><img src="trp1_1.gif"></td>
</tr>
</table>
<p>
Um die Bean beim Umgang mit gebundenen Eigenschaften zu unterstützen,
gibt es im Paket <a href="index_j.html#ixb100594"><font color=#000080><tt>java.beans</tt></font></a>
eine Hilfsklasse <a name="ixa103292"><a href="index_p.html#ixb102434"><font color=#000080><tt>PropertyChangeSupport</tt></font></a></a>.
Sie stellt einige nützliche Methoden zur Verfügung, mit
denen eine Bean die bei der Event-Registrierung und -verteilung anfallenden
Aufgaben delegieren kann:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void addPropertyChangeListener(
PropertyChangeListener listener
)
public void removePropertyChangeListener(
PropertyChangeListener listener
)
public void firePropertyChange(PropertyChangeEvent evt)
public void firePropertyChange(
String propertyName,
Object oldValue,
Object newValue
)
public void firePropertyChange(
String propertyName,
int oldValue,
int newValue
)
public void firePropertyChange(
String propertyName,
boolean oldValue,
boolean newValue
)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/beans/PropertyChangeSupport.html" onClick="this.href=getApiDoc('java.beans.PropertyChangeSupport')"><font color="#660066" size=-1>java.beans.PropertyChangeSupport</font></a></td>
</tr>
</table>
<p>
Die Bean instanziert bei Bedarf ein Objekt dieser Klasse und gibt
Aufrufe der eigenen Methoden <a href="index_a.html#ixb102432"><font color=#000080><tt>addPropertyChangeListener</tt></font></a>
und <a href="index_r.html#ixb102433"><font color=#000080><tt>removePropertyChangeListener</tt></font></a>
einfach weiter. Ändert sich eine gebundene Eigenschaft, ruft
die Bean eine der <a name="ixa103293"><a href="index_f.html#ixb102435"><font color=#000080><tt>firePropertyChange</tt></font></a></a>-Methoden
auf und sendet dadurch ein <a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a>
an alle registrierten Listener. Diese Methode steht einerseits vordefiniert
für die Typen <a href="index_i.html#ixb100244"><font color=#000080><tt>int</tt></font></a>,
<a href="index_b.html#ixb100072"><font color=#000080><tt>boolean</tt></font></a>
und <a href="index_o.html#ixb100224"><font color=#000080><tt>Object</tt></font></a>
zur Verfügung. Andererseits kann aber auch manuell ein <a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a>
erzeugt und weitergegeben werden.
<p>
Wir wollen uns als erstes Beispiel eine Bean ansehen, die einen beleuchteten
Taster implementiert. Der Taster kann wahlweise an- oder ausgeschaltet
sein. In angeschaltetem Zustand leuchtet er, in ausgeschaltetem Zustand
ist seine Oberfläche dunkel. Jeder Tastendruck schaltet zwischen
den beiden Zuständen um. Die wichtigste Eigenschaft des Tasters
heißt <font color="#000077"><tt>lightOn</tt></font>. Sie ist
gebunden und zeigt an, ob der Taster an- oder ausgeschaltet ist:
<a name="lightedpushbutton"></a>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#DDDDDD">
<tr>
<td valign=top>
<font color="#000055">
<pre>
<font color="#555555">001 </font><font color="#00AA00">/* LightedPushButton.java */</font>
<font color="#555555">002 </font>
<font color="#555555">003 </font><font color="#0000AA">import</font> java.awt.*;
<font color="#555555">004 </font><font color="#0000AA">import</font> java.awt.event.*;
<font color="#555555">005 </font><font color="#0000AA">import</font> java.io.*;
<font color="#555555">006 </font><font color="#0000AA">import</font> java.beans.*;
<font color="#555555">007 </font>
<font color="#555555">008 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> LightedPushButton
<font color="#555555">009 </font><font color="#0000AA">extends</font> Canvas
<font color="#555555">010 </font><font color="#0000AA">implements</font> Serializable
<font color="#555555">011 </font>{
<font color="#555555">012 </font> <font color="#00AA00">//---Instanzvariablen----------------------------------------</font>
<font color="#555555">013 </font> <font color="#0000AA">protected</font> Color linecolor;
<font color="#555555">014 </font> <font color="#0000AA">protected</font> Color framecolor;
<font color="#555555">015 </font> <font color="#0000AA">protected</font> Color lightoncolor;
<font color="#555555">016 </font> <font color="#0000AA">protected</font> Color lightoffcolor;
<font color="#555555">017 </font> <font color="#0000AA">protected</font> <font color="#006699">boolean</font> lighton;
<font color="#555555">018 </font> <font color="#0000AA">transient</font> <font color="#0000AA">protected</font> PropertyChangeSupport pchglisteners;
<font color="#555555">019 </font> <font color="#0000AA">transient</font> <font color="#0000AA">protected</font> VetoableChangeSupport vchglisteners;
<font color="#555555">020 </font>
<font color="#555555">021 </font> <font color="#00AA00">//---Methoden------------------------------------------------</font>
<font color="#555555">022 </font> <font color="#0000AA">public</font> LightedPushButton()
<font color="#555555">023 </font> {
<font color="#555555">024 </font> linecolor = Color.black;
<font color="#555555">025 </font> framecolor = Color.darkGray;
<font color="#555555">026 </font> lightoncolor = Color.red;
<font color="#555555">027 </font> lightoffcolor = <font color="#0000AA">new</font> Color(127, 0, 0); <font color="#00AA00">//dark red</font>
<font color="#555555">028 </font> lighton = <font color="#006699">false</font>;
<font color="#555555">029 </font> initTransientState();
<font color="#555555">030 </font> }
<font color="#555555">031 </font>
<font color="#555555">032 </font> <font color="#00AA00">//---Zustandsumschaltung Licht an/aus---</font>
<font color="#555555">033 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> setLightOn(<font color="#006699">boolean</font> on)
<font color="#555555">034 </font> <font color="#0000AA">throws</font> PropertyVetoException
<font color="#555555">035 </font> {
<font color="#555555">036 </font> <font color="#006699">boolean</font> oldvalue = <font color="#006699">this</font>.lighton;
<font color="#555555">037 </font> vchglisteners.fireVetoableChange(<font color="#0000FF">"lighton"</font>, oldvalue, on);
<font color="#555555">038 </font> <font color="#006699">this</font>.lighton = on;
<font color="#555555">039 </font> <font color="#0000AA">if</font> (oldvalue != on) {
<font color="#555555">040 </font> repaint();
<font color="#555555">041 </font> }
<font color="#555555">042 </font> pchglisteners.firePropertyChange(<font color="#0000FF">"lighton"</font>, oldvalue, on);
<font color="#555555">043 </font> }
<font color="#555555">044 </font>
<font color="#555555">045 </font> <font color="#0000AA">public</font> <font color="#006699">boolean</font> getLightOn()
<font color="#555555">046 </font> {
<font color="#555555">047 </font> <font color="#0000AA">return</font> <font color="#006699">this</font>.lighton;
<font color="#555555">048 </font> }
<font color="#555555">049 </font>
<font color="#555555">050 </font> <font color="#00AA00">//---Verwaltung der PropertyChangeListener---</font>
<font color="#555555">051 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> addPropertyChangeListener(PropertyChangeListener l)
<font color="#555555">052 </font> {
<font color="#555555">053 </font> pchglisteners.addPropertyChangeListener(l);
<font color="#555555">054 </font> }
<font color="#555555">055 </font>
<font color="#555555">056 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> removePropertyChangeListener(PropertyChangeListener l)
<font color="#555555">057 </font> {
<font color="#555555">058 </font> pchglisteners.removePropertyChangeListener(l);
<font color="#555555">059 </font> }
<font color="#555555">060 </font>
<font color="#555555">061 </font> <font color="#00AA00">//---Verwaltung der VetoableChangeListener---</font>
<font color="#555555">062 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> addVetoableChangeListener(VetoableChangeListener l)
<font color="#555555">063 </font> {
<font color="#555555">064 </font> vchglisteners.addVetoableChangeListener(l);
<font color="#555555">065 </font> }
<font color="#555555">066 </font>
<font color="#555555">067 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> removeVetoableChangeListener(VetoableChangeListener l)
<font color="#555555">068 </font> {
<font color="#555555">069 </font> vchglisteners.removeVetoableChangeListener(l);
<font color="#555555">070 </font> }
<font color="#555555">071 </font>
<font color="#555555">072 </font> <font color="#00AA00">//---Implementierung der Oberfläche---</font>
<font color="#555555">073 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> paint(Graphics g)
<font color="#555555">074 </font> {
<font color="#555555">075 </font> <font color="#006699">int</font> width = getSize().width;
<font color="#555555">076 </font> <font color="#006699">int</font> height = getSize().height;
<font color="#555555">077 </font> <font color="#00AA00">//Rahmen</font>
<font color="#555555">078 </font> g.setColor(framecolor);
<font color="#555555">079 </font> g.fillOval(0, 0, width, height);
<font color="#555555">080 </font> <font color="#00AA00">//Beleuchtung</font>
<font color="#555555">081 </font> g.setColor(lighton ? lightoncolor : lightoffcolor);
<font color="#555555">082 </font> g.fillOval(4, 4, width - 8, height - 8);
<font color="#555555">083 </font> <font color="#00AA00">//Konturlinien</font>
<font color="#555555">084 </font> g.setColor(linecolor);
<font color="#555555">085 </font> g.drawOval(0, 0, width - 1, height - 1);
<font color="#555555">086 </font> g.drawOval(3, 3, width - 7, height - 7);
<font color="#555555">087 </font> }
<font color="#555555">088 </font>
<font color="#555555">089 </font> <font color="#0000AA">public</font> Dimension getPreferredSize()
<font color="#555555">090 </font> {
<font color="#555555">091 </font> <font color="#0000AA">return</font> <font color="#0000AA">new</font> Dimension(32, 32);
<font color="#555555">092 </font> }
<font color="#555555">093 </font>
<font color="#555555">094 </font> <font color="#0000AA">public</font> Dimension getMinimumSize()
<font color="#555555">095 </font> {
<font color="#555555">096 </font> <font color="#0000AA">return</font> <font color="#0000AA">new</font> Dimension(16, 16);
<font color="#555555">097 </font> }
<font color="#555555">098 </font>
<font color="#555555">099 </font> <font color="#00AA00">//---Private Klassen---------------------------------------</font>
<font color="#555555">100 </font> <font color="#00AA00">/**
<font color="#555555">101 </font> * Initialisierung der nicht-persistenten Instanzvariablen.
<font color="#555555">102 </font> */</font>
<font color="#555555">103 </font> <font color="#0000AA">private</font> <font color="#006699">void</font> initTransientState()
<font color="#555555">104 </font> {
<font color="#555555">105 </font> pchglisteners = <font color="#0000AA">new</font> PropertyChangeSupport(<font color="#006699">this</font>);
<font color="#555555">106 </font> vchglisteners = <font color="#0000AA">new</font> VetoableChangeSupport(<font color="#006699">this</font>);
<font color="#555555">107 </font> addMouseListener(<font color="#0000AA">new</font> MouseClickAdapter());
<font color="#555555">108 </font> }
<font color="#555555">109 </font>
<font color="#555555">110 </font> <font color="#00AA00">/**
<font color="#555555">111 </font> * Wird überlagert, um nach dem Deserialisieren den transienten
<font color="#555555">112 </font> * Zustand zu initialisieren.
<font color="#555555">113 </font> */</font>
<font color="#555555">114 </font> <font color="#0000AA">private</font> <font color="#006699">void</font> readObject(ObjectInputStream stream)
<font color="#555555">115 </font> <font color="#0000AA">throws</font> IOException, ClassNotFoundException
<font color="#555555">116 </font> {
<font color="#555555">117 </font> stream.defaultReadObject();
<font color="#555555">118 </font> initTransientState();
<font color="#555555">119 </font> }
<font color="#555555">120 </font>
<font color="#555555">121 </font> <font color="#00AA00">//---Lokale Klassen----------------------------------------</font>
<font color="#555555">122 </font> <font color="#0000AA">class</font> MouseClickAdapter
<font color="#555555">123 </font> <font color="#0000AA">extends</font> MouseAdapter
<font color="#555555">124 </font> {
<font color="#555555">125 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> mouseClicked(MouseEvent event)
<font color="#555555">126 </font> {
<font color="#555555">127 </font> <font color="#0000AA">try</font> {
<font color="#555555">128 </font> setLightOn(!getLightOn());
<font color="#555555">129 </font> } <font color="#0000AA">catch</font> (PropertyVetoException e) {
<font color="#555555">130 </font> <font color="#00AA00">//no change if vetoed</font>
<font color="#555555">131 </font> }
<font color="#555555">132 </font> }
<font color="#555555">133 </font> }
<font color="#555555">134 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/LightedPushButton.java"><font color="#000055" size=-1>LightedPushButton.java</font></a></td>
</tr>
</table>
<i>
Listing 44.6: Ein beleuchteter Taster</i></p>
<p>
Die Klasse verwendet ein <a href="index_p.html#ixb102434"><font color=#000080><tt>PropertyChangeSupport</tt></font></a>-Objekt,
um die Listener zu verwalten und sie von Änderungen des Beleuchtungszustands
zu unterrichten. Das hier ebenfalls verwendete <a href="index_v.html#ixb102436"><font color=#000080><tt>VetoableChangeSupport</tt></font></a>-Objekt
und die mit seiner Hilfe implementierten Methoden werden im nächsten
Abschnitt erläutert und können zunächst ignoriert werden.
<p>
Interessant ist die Implementierung der Methode <font color="#000077"><tt>setLightOn</tt></font>.
Sie merkt sich zunächst den bisherigen Zustand und schaltet dann
auf den neuen Zustand um. Anschließend werden alle registrierten
Listener über die Änderung benachrichtigt. Der Name der
gebundenen Eigenschaft ist »lighton« und entspricht damit
dem Namen der betroffenen Eigenschaft. Eine eindeutige Benennung erlaubt
es registrierten Listenern, zwischen Benachrichtigungen für unterschiedliche
Eigenschaften zu unterscheiden.
<p>
<a href="k100283.html#beanbox3">Abbildung 44.5</a> zeigt die Klasse
<font color="#000077"><tt>LightedPushButton</tt></font> in ihren beiden
möglichen Zuständen in der Beanbox.
<!-- Section -->
<a name="sectlevel3id044004002"></a>
<h3>44.4.2 Constrained Properties </h3>
<p>
Eine Erweiterung der gebundenen Eigenschaften wurde im vorigen Abschnitt
schon angedeutet. Mit dem Konzept der <a name="ixa103294"><i>Constrained Properties</i></a>
( »verbotene« oder »unterbundene« Eigenschaften)
kann eine Bean registrierten Listenern die Möglichkeit geben,
Eigenschaftenänderungen zu verhindern.
<p>
Ein Listener, der das tun will, muss das Interface <a name="ixa103295"><a href="index_v.html#ixb102438"><font color=#000080><tt>VetoableChangeListener</tt></font></a></a>
implementieren. Es stellt nur eine Methode zur Verfügung:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void vetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/beans/VetoableChangeListener.html" onClick="this.href=getApiDoc('java.beans.VetoableChangeListener')"><font color="#660066" size=-1>java.beans.VetoableChangeListener</font></a></td>
</tr>
</table>
<p>
Immer wenn sich eine Constrained Property ändern soll, ruft die
Bean <i>vor der Änderung</i> bei den registrierten Listenern
die Methode <a name="ixa103296"><a href="index_v.html#ixb102439"><font color=#000080><tt>vetoableChange</tt></font></a></a>
auf. Der Empfänger prüft daraufhin das übergebene <a href="index_p.html#ixb102426"><font color=#000080><tt>PropertyChangeEvent</tt></font></a>
und entscheidet, ob er dem Änderungswunsch zustimmen soll oder
nicht. Ist das nicht der Fall, löst er eine <a name="ixa103297"><a href="index_p.html#ixb102440"><font color=#000080><tt>PropertyVetoException</tt></font></a></a>
aus, die beim Empfänger dazu führt, dass der Änderungsvorgang
abgebrochen wird. Stimmt er dagegen zu, ist gar nichts zu tun. Der
Listener terminiert einfach und die Bean fährt mit der Befragung
beim nächsten Listener fort. Nur wenn alle Listener zugestimmt
haben (also niemand eine <a href="index_p.html#ixb102440"><font color=#000080><tt>PropertyVetoException</tt></font></a>
ausgelöst hat), wird die Änderung tatsächlich durchgeführt.
<p>
Die Methode <font color="#000077"><tt>setLightOn</tt></font> in <a href="k100283.html#lightedpushbutton">Listing 44.6</a>
macht »lightOn« also sowohl zu einer gebundenen als auch
unterbindbaren Eigenschaft. Zunächst prüft sie, ob alle
registrierten <a href="index_v.html#ixb102438"><font color=#000080><tt>VetoableChangeListener</tt></font></a>
eine mögliche Zustandsänderung nicht ablehnen. Erst wenn
das der Fall ist, wird die Änderung tatsächlich durchgeführt,
und die registrierten <a href="index_p.html#ixb102430"><font color=#000080><tt>PropertyChangeListener</tt></font></a>
werden darüber informiert.
<p>
Das Registrieren und Deregistrieren erfolgt mit den Methoden <a name="ixa103298"><a href="index_a.html#ixb102441"><font color=#000080><tt>addVetoableChangeListener</tt></font></a></a>
und <a name="ixa103299"><a href="index_r.html#ixb102442"><font color=#000080><tt>removeVetoableChangeListener</tt></font></a></a>.
Ebenso wie die korrespondierenden Methoden zur Registrierung der <a href="index_p.html#ixb102430"><font color=#000080><tt>PropertyChangeListener</tt></font></a>
müssen ihre Namen und Parameter genau der hier angegebenen Form
entsprechen, damit sie vom GUI-Designer gefunden werden.
<p>
Zur Unterstützung bei der Implementierung kann sich die Bean
der Klasse <a name="ixa103300"><a href="index_v.html#ixb102436"><font color=#000080><tt>VetoableChangeSupport</tt></font></a></a>
bedienen, die ähnliche Methoden wie <a href="index_p.html#ixb102434"><font color=#000080><tt>PropertyChangeSupport</tt></font></a>
zur Verfügung stellt:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void addVetoableChangeListener(
VetoableChangeListener listener
)
public void removeVetoableChangeListener(
VetoableChangeListener listener
)
public void fireVetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException
public void fireVetoableChange(
String propertyName,
Object oldValue,
Object newValue
)
throws PropertyVetoException
public void fireVetoableChange(
String propertyName,
int oldValue,
int newValue
)
throws PropertyVetoException
public void fireVetoableChange(
String propertyName,
boolean oldValue,
boolean newValue
)
throws PropertyVetoException
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/beans/VetoableChangeSupport.html" onClick="this.href=getApiDoc('java.beans.VetoableChangeSupport')"><font color="#660066" size=-1>java.beans.VetoableChangeSupport</font></a></td>
</tr>
</table>
<p>
Um im nächsten Abschnitt ein Beispiel für die Anwendung
von Constrained Properties geben zu können, wollen wir eine Klasse
vorstellen, die das Interface <a href="index_v.html#ixb102438"><font color=#000080><tt>VetoableChangeListener</tt></font></a>
implementiert. Sie wird durch eine Bean repräsentiert, die einen
einfachen Umschalter darstellt, der durch Mausklick geöffnet
oder geschlossen werden kann. Ist der Schalter geschlossen, sind Eigenschaftsänderungen
erlaubt. Ist er dagegen geöffnet, wird bei jedem Aufruf von <a href="index_v.html#ixb102439"><font color=#000080><tt>vetoableChange</tt></font></a>
eine <a href="index_p.html#ixb102440"><font color=#000080><tt>PropertyVetoException</tt></font></a>
ausgelöst. Auf diese Weise werden bei geöffnetem Schalter
alle Eigenschaftsänderungen verhindert:
<a name="vetoswitch"></a>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#DDDDDD">
<tr>
<td valign=top>
<font color="#000055">
<pre>
<font color="#555555">001 </font><font color="#00AA00">/* VetoSwitch.java */</font>
<font color="#555555">002 </font>
<font color="#555555">003 </font><font color="#0000AA">import</font> java.awt.*;
<font color="#555555">004 </font><font color="#0000AA">import</font> java.awt.event.*;
<font color="#555555">005 </font><font color="#0000AA">import</font> java.io.*;
<font color="#555555">006 </font><font color="#0000AA">import</font> java.beans.*;
<font color="#555555">007 </font>
<font color="#555555">008 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> VetoSwitch
<font color="#555555">009 </font><font color="#0000AA">extends</font> Canvas
<font color="#555555">010 </font><font color="#0000AA">implements</font> Serializable, VetoableChangeListener
<font color="#555555">011 </font>{
<font color="#555555">012 </font> <font color="#00AA00">//---Instanzvariablen----------------------------------------</font>
<font color="#555555">013 </font> <font color="#0000AA">protected</font> Color linecolor;
<font color="#555555">014 </font> <font color="#0000AA">protected</font> <font color="#006699">boolean</font> vetoallchanges;
<font color="#555555">015 </font>
<font color="#555555">016 </font> <font color="#00AA00">//---Methoden------------------------------------------------</font>
<font color="#555555">017 </font> <font color="#0000AA">public</font> VetoSwitch()
<font color="#555555">018 </font> {
<font color="#555555">019 </font> <font color="#006699">this</font>.linecolor = Color.black;
<font color="#555555">020 </font> <font color="#006699">this</font>.vetoallchanges = <font color="#006699">false</font>;
<font color="#555555">021 </font> initTransientState();
<font color="#555555">022 </font> }
<font color="#555555">023 </font>
<font color="#555555">024 </font> <font color="#00AA00">//---Konturenfarbe---</font>
<font color="#555555">025 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> setLineColor(Color color)
<font color="#555555">026 </font> {
<font color="#555555">027 </font> <font color="#006699">this</font>.linecolor = color;
<font color="#555555">028 </font> }
<font color="#555555">029 </font>
<font color="#555555">030 </font> <font color="#0000AA">public</font> Color getLineColor()
<font color="#555555">031 </font> {
<font color="#555555">032 </font> <font color="#0000AA">return</font> <font color="#006699">this</font>.linecolor;
<font color="#555555">033 </font> }
<font color="#555555">034 </font>
<font color="#555555">035 </font> <font color="#00AA00">//---Zustandsumschaltung Licht an/aus---</font>
<font color="#555555">036 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> setVetoAllChanges(<font color="#006699">boolean</font> b)
<font color="#555555">037 </font> {
<font color="#555555">038 </font> <font color="#0000AA">if</font> (<font color="#006699">this</font>.vetoallchanges != b) {
<font color="#555555">039 </font> <font color="#006699">this</font>.vetoallchanges = b;
<font color="#555555">040 </font> repaint();
<font color="#555555">041 </font> }
<font color="#555555">042 </font> }
<font color="#555555">043 </font>
<font color="#555555">044 </font> <font color="#0000AA">public</font> <font color="#006699">boolean</font> getVetoAllChanges()
<font color="#555555">045 </font> {
<font color="#555555">046 </font> <font color="#0000AA">return</font> <font color="#006699">this</font>.vetoallchanges;
<font color="#555555">047 </font> }
<font color="#555555">048 </font>
<font color="#555555">049 </font> <font color="#00AA00">//---Veto---</font>
<font color="#555555">050 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> vetoableChange(PropertyChangeEvent e)
<font color="#555555">051 </font> <font color="#0000AA">throws</font> PropertyVetoException
<font color="#555555">052 </font> {
<font color="#555555">053 </font> <font color="#0000AA">if</font> (<font color="#006699">this</font>.vetoallchanges) {
<font color="#555555">054 </font> <font color="#0000AA">throw</font> <font color="#0000AA">new</font> PropertyVetoException(<font color="#0000FF">"!!!VETO!!!"</font>, e);
<font color="#555555">055 </font> }
<font color="#555555">056 </font> }
<font color="#555555">057 </font>
<font color="#555555">058 </font> <font color="#00AA00">//---Implementierung der Oberfläche---</font>
<font color="#555555">059 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> paint(Graphics g)
<font color="#555555">060 </font> {
<font color="#555555">061 </font> <font color="#006699">int</font> width = getSize().width;
<font color="#555555">062 </font> <font color="#006699">int</font> height = getSize().height;
<font color="#555555">063 </font> g.setColor(linecolor);
<font color="#555555">064 </font> g.drawRect(0, 0, width - 1, height - 1);
<font color="#555555">065 </font> g.drawLine(width * 1 / 8, height / 2, width * 3 / 8, height / 2);
<font color="#555555">066 </font> g.drawLine(width * 5 / 8, height / 2, width * 7 / 8, height / 2);
<font color="#555555">067 </font> g.fillRect(width * 3 / 8 - 1, height / 2 - 1, 3, 3);
<font color="#555555">068 </font> g.fillRect(width * 5 / 8 - 1, height / 2 - 1, 3, 3);
<font color="#555555">069 </font> <font color="#0000AA">if</font> (<font color="#006699">this</font>.vetoallchanges) {
<font color="#555555">070 </font> <font color="#00AA00">//draw open connection</font>
<font color="#555555">071 </font> g.drawLine(width * 3 / 8, height / 2, width * 5 / 8, height / 4);
<font color="#555555">072 </font> } <font color="#0000AA">else</font> {
<font color="#555555">073 </font> <font color="#00AA00">//draw short-cutted connection</font>
<font color="#555555">074 </font> g.drawLine(width * 3 / 8, height / 2, width * 5 / 8, height / 2);
<font color="#555555">075 </font> }
<font color="#555555">076 </font> }
<font color="#555555">077 </font>
<font color="#555555">078 </font> <font color="#0000AA">public</font> Dimension getPreferredSize()
<font color="#555555">079 </font> {
<font color="#555555">080 </font> <font color="#0000AA">return</font> <font color="#0000AA">new</font> Dimension(60, 20);
<font color="#555555">081 </font> }
<font color="#555555">082 </font>
<font color="#555555">083 </font> <font color="#0000AA">public</font> Dimension getMinimumSize()
<font color="#555555">084 </font> {
<font color="#555555">085 </font> <font color="#0000AA">return</font> <font color="#0000AA">new</font> Dimension(28, 10);
<font color="#555555">086 </font> }
<font color="#555555">087 </font>
<font color="#555555">088 </font> <font color="#00AA00">//---Private Klassen----------------------------------------</font>
<font color="#555555">089 </font> <font color="#0000AA">private</font> <font color="#006699">void</font> initTransientState()
<font color="#555555">090 </font> {
<font color="#555555">091 </font> addMouseListener(<font color="#0000AA">new</font> MouseClickAdapter());
<font color="#555555">092 </font> }
<font color="#555555">093 </font>
<font color="#555555">094 </font> <font color="#00AA00">/**
<font color="#555555">095 </font> * Wird überlagert, um nach dem Deserialisieren den transienten
<font color="#555555">096 </font> * Zustand zu initialisieren.
<font color="#555555">097 </font> */</font>
<font color="#555555">098 </font> <font color="#0000AA">private</font> <font color="#006699">void</font> readObject(ObjectInputStream stream)
<font color="#555555">099 </font> <font color="#0000AA">throws</font> IOException, ClassNotFoundException
<font color="#555555">100 </font> {
<font color="#555555">101 </font> stream.defaultReadObject();
<font color="#555555">102 </font> initTransientState();
<font color="#555555">103 </font> }
<font color="#555555">104 </font>
<font color="#555555">105 </font> <font color="#00AA00">//---Lokale Klassen----------------------------------------</font>
<font color="#555555">106 </font> <font color="#0000AA">class</font> MouseClickAdapter
<font color="#555555">107 </font> <font color="#0000AA">extends</font> MouseAdapter
<font color="#555555">108 </font> {
<font color="#555555">109 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> mouseClicked(MouseEvent event)
<font color="#555555">110 </font> {
<font color="#555555">111 </font> setVetoAllChanges(!getVetoAllChanges());
<font color="#555555">112 </font> }
<font color="#555555">113 </font> }
<font color="#555555">114 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/VetoSwitch.java"><font color="#000055" size=-1>VetoSwitch.java</font></a></td>
</tr>
</table>
<i>
Listing 44.7: Ein Veto-Schalter</i></p>
<p>
<a href="k100283.html#beanbox3">Abbildung 44.5</a> zeigt die Klasse
<font color="#000077"><tt>VetoSwitch</tt></font> in ihren beiden möglichen
Zuständen in der Beanbox:
<p>
<a name="beanbox3"></a>
<img src="images/Beanbox3.gif">
<p>
<p><i>
Abbildung 44.5: LightedPushButton und VetoSwitch in der Beanbox</i></p>
<!-- Section -->
<a name="sectlevel3id044004003"></a>
<h3>44.4.3 Anwendungsbeispiel </h3>
<p>
Das folgende Listing zeigt die drei bisher definierten Beans im Zusammenspiel.
Zunächst werden alle drei Elemente instanziert und auf einem
Frame platziert. Da der <font color="#000077"><tt>LightedPushButton</tt></font>
bei jedem Tastendruck den Zustand der <font color="#000077"><tt>LightBulb</tt></font>
umschalten soll, bekommt er einen <a href="index_p.html#ixb102430"><font color=#000080><tt>PropertyChangeListener</tt></font></a>
zugeordnet, der bei Zustandsänderungen der Eigenschaft »lighton«
die Lampe umschaltet.
<p>
Der <font color="#000077"><tt>VetoSwitch</tt></font> wird als <a href="index_v.html#ixb102438"><font color=#000080><tt>VetoableChangeListener</tt></font></a>
ebenfalls beim <font color="#000077"><tt>LightedPushButton</tt></font>
registriert. Da er in geöffnetem Zustand alle unterbindbaren
Eigenschaftenänderungen verhindert, dient er dazu, die Funktion
des Buttons zu deaktivieren. Nur, wenn der <font color="#000077"><tt>VetoSwitch</tt></font>
geschlossen ist, hat das Drücken des <font color="#000077"><tt>LightedPushButton</tt></font>
eine Änderung des Lampenzustands zur Folge.
<a name="listingid044008"></a>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#DDDDDD">
<tr>
<td valign=top>
<font color="#000055">
<pre>
<font color="#555555">001 </font><font color="#00AA00">/* Listing4408.java */</font>
<font color="#555555">002 </font>
<font color="#555555">003 </font><font color="#0000AA">import</font> java.awt.*;
<font color="#555555">004 </font><font color="#0000AA">import</font> java.awt.event.*;
<font color="#555555">005 </font><font color="#0000AA">import</font> java.beans.*;
<font color="#555555">006 </font>
<font color="#555555">007 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> Listing4408
<font color="#555555">008 </font><font color="#0000AA">extends</font> Frame
<font color="#555555">009 </font>{
<font color="#555555">010 </font> <font color="#0000AA">public</font> Listing4408()
<font color="#555555">011 </font> {
<font color="#555555">012 </font> <font color="#00AA00">//Initialisierung</font>
<font color="#555555">013 </font> <font color="#006699">super</font>(<font color="#0000FF">"BeanPropertiesTest"</font>);
<font color="#555555">014 </font> setLayout(<font color="#0000AA">new</font> FlowLayout());
<font color="#555555">015 </font> setBackground(Color.lightGray);
<font color="#555555">016 </font> addWindowListener(
<font color="#555555">017 </font> <font color="#0000AA">new</font> WindowAdapter() {
<font color="#555555">018 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> windowClosing(WindowEvent event)
<font color="#555555">019 </font> {
<font color="#555555">020 </font> System.exit(0);
<font color="#555555">021 </font> }
<font color="#555555">022 </font> }
<font color="#555555">023 </font> );
<font color="#555555">024 </font> <font color="#00AA00">//Dialogelemente hinzufügen</font>
<font color="#555555">025 </font> LightedPushButton button1 = <font color="#0000AA">new</font> LightedPushButton();
<font color="#555555">026 </font> VetoSwitch veto1 = <font color="#0000AA">new</font> VetoSwitch();
<font color="#555555">027 </font> <font color="#0000AA">final</font> LightBulb bulb1 = <font color="#0000AA">new</font> LightBulb();
<font color="#555555">028 </font> add(button1);
<font color="#555555">029 </font> add(veto1);
<font color="#555555">030 </font> add(bulb1);
<font color="#555555">031 </font> button1.addPropertyChangeListener(
<font color="#555555">032 </font> <font color="#0000AA">new</font> PropertyChangeListener() {
<font color="#555555">033 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> propertyChange(PropertyChangeEvent e)
<font color="#555555">034 </font> {
<font color="#555555">035 </font> <font color="#0000AA">if</font> (e.getPropertyName().equals(<font color="#0000FF">"lighton"</font>)) {
<font color="#555555">036 </font> Boolean on = (Boolean)e.getNewValue();
<font color="#555555">037 </font> bulb1.setLightOn(on.booleanValue());
<font color="#555555">038 </font> }
<font color="#555555">039 </font> }
<font color="#555555">040 </font> }
<font color="#555555">041 </font> );
<font color="#555555">042 </font> button1.addVetoableChangeListener(veto1);
<font color="#555555">043 </font> }
<font color="#555555">044 </font>
<font color="#555555">045 </font> <font color="#00AA00">//---main-------------------------------------------------</font>
<font color="#555555">046 </font> <font color="#0000AA">public</font> <font color="#0000AA">static</font> <font color="#006699">void</font> main(String[] args)
<font color="#555555">047 </font> {
<font color="#555555">048 </font> Listing4408 frm = <font color="#0000AA">new</font> Listing4408();
<font color="#555555">049 </font> frm.setLocation(100, 100);
<font color="#555555">050 </font> frm.pack();
<font color="#555555">051 </font> frm.setVisible(<font color="#006699">true</font>);
<font color="#555555">052 </font> }
<font color="#555555">053 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/Listing4408.java"><font color="#000055" size=-1>Listing4408.java</font></a></td>
</tr>
</table>
<i>
Listing 44.8: Eigenschaftenänderungen von Beans</i></p>
<p>
<a href="k100283.html#propertiestest">Abbildung 44.6</a> zeigt das
Programm mit angeschalteter Lampe und anschließend geöffnetem
Schalter. Das Drücken des Tasters bleibt nun so lange erfolglos,
bis der Schalter wieder geschlossen wird.
<p>
<a name="propertiestest"></a>
<img src="images/Beanprops.gif">
<p>
<p><i>
Abbildung 44.6: Testprogramm für Eigenschaftenänderungen</i></p>
<hr>
<table border=0 cellpadding=0 cellspacing=1 width="100%">
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="cover.html"> Titel </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100003.html"> Inhalt </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="search.html"> Suchen </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="index.html"> Index </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/index.html" onClick="this.href=getDocIndex()"> DOC </a>
<td align="right">Handbuch der Java-Programmierung, 5. Auflage, Addison
Wesley, Version 5.0.1
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100279.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100282.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100284.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100287.html"> >> </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/api/index.html" onClick="this.href=getApiIndex()"> API </a>
<td align="right">© 1998, 2007 Guido Krüger & Thomas
Stark, <a href="http://www.javabuch.de">http://www.javabuch.de</a>
</table>
<a name="endofbody"></a>
</body>
</html>
|