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
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
|
<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,k100237.html;106,k100240.html;107,k100242.html;108,k100243.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="k100237.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100240.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100242.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100243.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 37 - Swing: Komponenten I
</table>
<hr>
<!-- Section -->
<a name="sectlevel2id037004"></a>
<h2>37.4 Quasi-analoge Komponenten </h2>
<hr>
<ul>
<li><a href="k100241.html#sectlevel2id037004">37.4 Quasi-analoge Komponenten</a>
<ul>
<li><a href="k100241.html#sectlevel3id037004001">37.4.1 JScrollBar</a>
<li><a href="k100241.html#sectlevel3id037004002">37.4.2 JSlider</a>
<li><a href="k100241.html#sectlevel3id037004003">37.4.3 JProgressBar</a>
</ul>
</ul>
<hr>
<!-- Section -->
<a name="sectlevel3id037004001"></a>
<h3>37.4.1 JScrollBar </h3>
<p>
<a name="ixa102676"><a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a></a>
ist die leichtgewichtige Swing-Variante der AWT-Klasse <a href="index_s.html#ixb101478"><font color=#000080><tt>Scrollbar</tt></font></a>
(siehe <a href="k100216.html#scrollbar">Abschnitt 32.10</a>). Sie
dient dazu, mit Hilfe eines Schiebereglers einen Wert kontinuierlich
innerhalb vorgegebener Grenzen einzustellen. Der wichtigste Konstruktor
der Klasse <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
ist:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public JScrollBar(
int orientation,
int value,
int extent,
int min,
int max
)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JScrollBar.html" onClick="this.href=getApiDoc('javax.swing.JScrollBar')"><font color="#660066" size=-1>javax.swing.JScrollBar</font></a></td>
</tr>
</table>
<p>
Mit <font color="#000077"><tt>orientation</tt></font> wird die Ausrichtung
des Schiebereglers festgelegt. Sie kann entweder <a href="index_h.html#ixb101624"><font color=#000080><tt>HORIZONTAL</tt></font></a>
oder <a href="index_v.html#ixb101625"><font color=#000080><tt>VERTICAL</tt></font></a>
sein. <font color="#000077"><tt>min</tt></font> gibt den kleinsten,
<font color="#000077"><tt>max</tt></font> den größten möglichen
Wert an. Mit <font color="#000077"><tt>extent</tt></font> wird die
Ausdehnung des Schiebers festgelegt. Sie muss mindestens eins, kann
aber auch größer sein. <font color="#000077"><tt>value</tt></font>
ist der Anfangswert des Schiebers. Er muss zwischen <font color="#000077"><tt>min</tt></font>
und <font color="#000077"><tt>max - extent</tt></font> liegen.
<p>
<a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
stellt einige Methoden zur Verfügung, mit denen nach der Instanzierung
auf die numerischen Eigenschaften des Schiebereglers zugegriffen werden
kann:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public int getMinimum()
public void setMinimum(int minimum)
public int getMaximum()
public void setMaximum(int maximum)
public int getVisibleAmount()
public void setVisibleAmount(int extent)
public int getValue()
public void setValue(int value)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JScrollBar.html" onClick="this.href=getApiDoc('javax.swing.JScrollBar')"><font color="#660066" size=-1>javax.swing.JScrollBar</font></a></td>
</tr>
</table>
<p>
Mit <a name="ixa102677"><a href="index_g.html#ixb101687"><font color=#000080><tt>getMinimum</tt></font></a></a>,
<a name="ixa102678"><a href="index_g.html#ixb101688"><font color=#000080><tt>getMaximum</tt></font></a></a>,
<a name="ixa102679"><a href="index_s.html#ixb101980"><font color=#000080><tt>setMinimum</tt></font></a></a>
und <a name="ixa102680"><a href="index_s.html#ixb101981"><font color=#000080><tt>setMaximum</tt></font></a></a>
kann auf das Minimum und Maximum des definierten Wertebereichs zugegriffen
werden. <a name="ixa102681"><a href="index_g.html#ixb101689"><font color=#000080><tt>getVisibleAmount</tt></font></a></a>
liefert die Ausdehnung des Schiebers, und mit <a name="ixa102682"><a href="index_s.html#ixb101982"><font color=#000080><tt>setVisibleAmount</tt></font></a></a>
kann diese abgefragt werden. Mit <a name="ixa102683"><a href="index_g.html#ixb100752"><font color=#000080><tt>getValue</tt></font></a></a>
und <a name="ixa102684"><a href="index_s.html#ixb101686"><font color=#000080><tt>setValue</tt></font></a></a>
kann auf den aktuellen Wert des Schiebereglers zugegriffen werden.
<p>
Auch auf die Seitengröße kann zugegriffen werden:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public int getUnitIncrement()
public void setUnitIncrement(int unitIncrement)
public int getBlockIncrement()
public void setBlockIncrement(int blockIncrement)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JScrollBar.html" onClick="this.href=getApiDoc('javax.swing.JScrollBar')"><font color="#660066" size=-1>javax.swing.JScrollBar</font></a></td>
</tr>
</table>
<p>
<a name="ixa102685"><a href="index_g.html#ixb101690"><font color=#000080><tt>getUnitIncrement</tt></font></a></a>
gibt an, um welchen Betrag der Wert des Schiebereglers verändert
wird, wenn der Anwender einen der Pfeilbuttons betätigt. <a name="ixa102686"><a href="index_g.html#ixb101692"><font color=#000080><tt>getBlockIncrement</tt></font></a></a>
ermittelt analog dazu den Betrag der Änderung, wenn zwischen
Schieber und Pfeilbuttons geklickt wird. Mit <a name="ixa102687"><a href="index_s.html#ixb101691"><font color=#000080><tt>setUnitIncrement</tt></font></a></a>
und <a name="ixa102688"><a href="index_s.html#ixb101693"><font color=#000080><tt>setBlockIncrement</tt></font></a></a>
können beide Werte auch verändert werden.
<p>
Wird der Wert einer <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
verändert, sendet sie ein <a href="index_a.html#ixb101405"><font color=#000080><tt>AdjustmentEvent</tt></font></a>
an registrierte Listener. Diese müssen das Interface <a href="index_a.html#ixb101476"><font color=#000080><tt>AdjustmentListener</tt></font></a>
implementieren und werden durch Aufruf von <a name="ixa102689"><a href="index_a.html#ixb101477"><font color=#000080><tt>addAdjustmentListener</tt></font></a></a>
registriert. Interessant ist in diesem Zusammenhang die Methode <a name="ixa102690"><a href="index_g.html#ixb101983"><font color=#000080><tt>getValueIsAdjusting()</tt></font></a></a>,
mit der festgestellt werden kann, auf welche Weise der Wert verändert
wird. Sie gibt genau dann <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
zurück, wenn die Änderung Bestandteil einer Kette von Änderungen
ist, wenn also der Anwender den Schieber betätigt. Wurde die
Änderung dagegen durch einen Mausklick auf einen der Buttons
oder auf die Fläche zwischen Buttons und Schieber ausgelöst,
liefert <a href="index_g.html#ixb101983"><font color=#000080><tt>getValueIsAdjusting()</tt></font></a>
den Wert <a href="index_f.html#ixb100234"><font color=#000080><tt>false</tt></font></a>.
<p>
Das folgende Programm zeigt eine einfache Anwendung der Klasse <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>.
Es stellt zwei Schieberegler zur Verfügung, mit deren Hilfe die
Hintergrundfarbe des in der Mitte angezeigten Panels verändert
werden kann. Alle Änderungen werden durch einen <a href="index_a.html#ixb101476"><font color=#000080><tt>AdjustmentListener</tt></font></a>
registriert und führen beim Panel zum Aufruf von <a href="index_s.html#ixb101159"><font color=#000080><tt>setBackground</tt></font></a>.
Am Ende einer Änderungssequenz wird der aktuelle Farbwert auf
der Konsole ausgegeben.
<a name="jscrollbarexample"></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">/* Listing3712.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> javax.swing.*;
<font color="#555555">006 </font>
<font color="#555555">007 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> Listing3712
<font color="#555555">008 </font><font color="#0000AA">extends</font> JFrame
<font color="#555555">009 </font><font color="#0000AA">implements</font> AdjustmentListener
<font color="#555555">010 </font>{
<font color="#555555">011 </font> <font color="#0000AA">private</font> JPanel coloredPanel;
<font color="#555555">012 </font> <font color="#0000AA">private</font> JScrollBar sbEast;
<font color="#555555">013 </font> <font color="#0000AA">private</font> JScrollBar sbSouth;
<font color="#555555">014 </font> <font color="#0000AA">private</font> <font color="#006699">int</font> blue = 0;
<font color="#555555">015 </font> <font color="#0000AA">private</font> <font color="#006699">int</font> red = 0;
<font color="#555555">016 </font>
<font color="#555555">017 </font> <font color="#0000AA">public</font> Listing3712()
<font color="#555555">018 </font> {
<font color="#555555">019 </font> <font color="#006699">super</font>(<font color="#0000FF">"JScrollBar"</font>);
<font color="#555555">020 </font> addWindowListener(<font color="#0000AA">new</font> WindowClosingAdapter(<font color="#006699">true</font>));
<font color="#555555">021 </font> Container cp = getContentPane();
<font color="#555555">022 </font> <font color="#00AA00">//Vertikaler Schieberegler</font>
<font color="#555555">023 </font> sbEast = <font color="#0000AA">new</font> JScrollBar(JScrollBar.VERTICAL, 0, 10, 0, 255);
<font color="#555555">024 </font> sbEast.addAdjustmentListener(<font color="#006699">this</font>);
<font color="#555555">025 </font> cp.add(sbEast, BorderLayout.EAST);
<font color="#555555">026 </font> <font color="#00AA00">//Horizontaler Schieberegler</font>
<font color="#555555">027 </font> sbSouth = <font color="#0000AA">new</font> JScrollBar(JScrollBar.HORIZONTAL, 0, 10, 0, 255);
<font color="#555555">028 </font> sbSouth.addAdjustmentListener(<font color="#006699">this</font>);
<font color="#555555">029 </font> cp.add(sbSouth, BorderLayout.SOUTH);
<font color="#555555">030 </font> <font color="#00AA00">//Farbiges Panel</font>
<font color="#555555">031 </font> coloredPanel = <font color="#0000AA">new</font> JPanel();
<font color="#555555">032 </font> coloredPanel.setBackground(<font color="#0000AA">new</font> Color(red, 0, blue));
<font color="#555555">033 </font> cp.add(coloredPanel, BorderLayout.CENTER);
<font color="#555555">034 </font> }
<font color="#555555">035 </font>
<font color="#555555">036 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> adjustmentValueChanged(AdjustmentEvent event)
<font color="#555555">037 </font> {
<font color="#555555">038 </font> JScrollBar sb = (JScrollBar)event.getSource();
<font color="#555555">039 </font> <font color="#0000AA">if</font> (sb == sbEast) {
<font color="#555555">040 </font> blue = event.getValue();
<font color="#555555">041 </font> } <font color="#0000AA">else</font> {
<font color="#555555">042 </font> red = event.getValue();
<font color="#555555">043 </font> }
<font color="#555555">044 </font> coloredPanel.setBackground(<font color="#0000AA">new</font> Color(red, 0, blue));
<font color="#555555">045 </font> <font color="#0000AA">if</font> (!sb.getValueIsAdjusting()) {
<font color="#555555">046 </font> System.out.println(<font color="#0000FF">"("</font> + red + <font color="#0000FF">",0,"</font> + blue + <font color="#0000FF">")"</font>);
<font color="#555555">047 </font> }
<font color="#555555">048 </font> }
<font color="#555555">049 </font>
<font color="#555555">050 </font> <font color="#0000AA">public</font> <font color="#0000AA">static</font> <font color="#006699">void</font> main(String[] args)
<font color="#555555">051 </font> {
<font color="#555555">052 </font> Listing3712 frame = <font color="#0000AA">new</font> Listing3712();
<font color="#555555">053 </font> frame.setLocation(100, 100);
<font color="#555555">054 </font> frame.setSize(200, 200);
<font color="#555555">055 </font> frame.setVisible(<font color="#006699">true</font>);
<font color="#555555">056 </font> }
<font color="#555555">057 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/Listing3712.java"><font color="#000055" size=-1>Listing3712.java</font></a></td>
</tr>
</table>
<i>
Listing 37.12: Die Klasse JScrollBar</i></p>
<p>
Die Programmausgabe ist:
<p>
<a name="imageid037010"></a>
<img src="images/JScrollBar1.gif">
<p>
<p><i>
Abbildung 37.10: Die Klasse JScrollBar</i></p>
<!-- Section -->
<a name="sectlevel3id037004002"></a>
<h3>37.4.2 JSlider </h3>
<p>
Mit der Klasse <a name="ixa102691"><a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a></a>
werden ebenso wie mit <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
Schieberegler erzeugt. Abgesehen von den unterschiedlichen Oberflächen
gibt es zwischen beiden Klassen zwei wichtige konzeptionelle Unterschiede:
<ol type=1>
<li>Ein <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
kann eine Anzeigeskala mit grober und feiner Einteilung und Beschriftung
haben.
<li>Ein <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
kennt keine unterschiedlichen Schiebergrößen. Die Ausdehnung
der Schieber ist immer 1.
</ol>
<p>
Welche der beiden Klassen in der Praxis eingesetzt werden soll, läßt
sich nicht eindeutig festlegen. Soll ein Bildschirminhalt verschoben
werden, ist es sicher sinnvoll, bei <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
zu bleiben. Soll dagegen ein Wert verändert werden, der für
den Anwender den Charakter einer Zahl hat, kann durchaus ein <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
verwendet werden.
<p>
Der wichtigste Konstruktor von <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
ist:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public JSlider(int orientation, int min, int max, int value)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JSlider.html" onClick="this.href=getApiDoc('javax.swing.JSlider')"><font color="#660066" size=-1>javax.swing.JSlider</font></a></td>
</tr>
</table>
<p>
Der Parameter <font color="#000077"><tt>orientation</tt></font> gibt
die Orientierung an. Hier können die Konstanten <a href="index_h.html#ixb101624"><font color=#000080><tt>HORIZONTAL</tt></font></a>
und <a href="index_v.html#ixb101625"><font color=#000080><tt>VERTICAL</tt></font></a>
übergeben werden. <font color="#000077"><tt>min</tt></font> und
<font color="#000077"><tt>max</tt></font> legen die Grenzen des Wertebereichs
fest, und mit <font color="#000077"><tt>value</tt></font> wird der
Anfangswert des Schiebers festgelegt. Ähnlich wie <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>
stellt auch <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
Methoden zum Zugriff auf die numerischen Eigenschaften des Sliders
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 int getMinimum()
public void setMinimum(int minimum)
public int getMaximum()
public void setMaximum(int maximum)
public int getValue()
public void setValue(int n)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JSlider.html" onClick="this.href=getApiDoc('javax.swing.JSlider')"><font color="#660066" size=-1>javax.swing.JSlider</font></a></td>
</tr>
</table>
<p>
Sie haben dieselbe Bedeutung wie bei <a href="index_j.html#ixb101979"><font color=#000080><tt>JScrollBar</tt></font></a>.
Zusätzlich gibt es Methoden zum Zugriff auf die Anzeigeskala
und die Beschriftung:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public int getMajorTickSpacing()
public void setMajorTickSpacing(int n)
public int getMinorTickSpacing()
public void setMinorTickSpacing(int n)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JSlider.html" onClick="this.href=getApiDoc('javax.swing.JSlider')"><font color="#660066" size=-1>javax.swing.JSlider</font></a></td>
</tr>
</table>
<p>
Die Anzeigeskala eines <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
hat große Markierungen, die das Grobraster vorgeben, und dazwischenstehende
kleine, die das Feinraster vorgeben. Mit <a name="ixa102692"><a href="index_s.html#ixb101985"><font color=#000080><tt>setMajorTickSpacing</tt></font></a></a>
wird der Abstand der großen Markierungen vorgegeben, mit <a name="ixa102693"><a href="index_s.html#ixb101986"><font color=#000080><tt>setMinorTickSpacing</tt></font></a></a>
der Abstand der kleinen. Mit <a name="ixa102694"><a href="index_g.html#ixb101987"><font color=#000080><tt>getMajorTickSpacing</tt></font></a></a>
und <a name="ixa102695"><a href="index_g.html#ixb101988"><font color=#000080><tt>getMinorTickSpacing</tt></font></a></a>
können beide Werte auch abgefragt werden.
<p>
Damit die Anzeigeskala tatsächlich angezeigt wird, muss <a name="ixa102696"><a href="index_s.html#ixb101989"><font color=#000080><tt>setPaintTicks</tt></font></a></a>
aufgerufen und <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
übergeben werden. Soll auch die Beschriftung angezeigt werden,
muss zusätzlich <a name="ixa102697"><a href="index_s.html#ixb101990"><font color=#000080><tt>setPaintLabels</tt></font></a></a>
mit <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
als Argument aufgerufen werden:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void setPaintTicks(boolean b)
public void setPaintLabels(boolean b)
public void setSnapToTicks(boolean b)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JSlider.html" onClick="this.href=getApiDoc('javax.swing.JSlider')"><font color="#660066" size=-1>javax.swing.JSlider</font></a></td>
</tr>
</table>
<p>
Ein Aufruf von <a name="ixa102698"><a href="index_s.html#ixb101991"><font color=#000080><tt>setSnapToTicks</tt></font></a></a>
(mit Übergabe von <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
als Argument) sorgt dafür, dass der Schieber stets auf den Skalenmarkierungen
einrastet. Zwischenpositionen können dann nicht mehr angewählt
werden.
<p>
Im Gegensatz zu <a href="index_j.html#ixb101779"><font color=#000080><tt>JScrollPane</tt></font></a>
sendet ein <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
kein <a href="index_a.html#ixb101405"><font color=#000080><tt>AdjustmentEvent</tt></font></a>,
wenn sein Wert verändert wird, sondern ein <a name="ixa102699"><a href="index_c.html#ixb101992"><font color=#000080><tt>ChangeEvent</tt></font></a></a>
(diese Klasse liegt im Paket <a name="ixa102700"><a href="index_j.html#ixb101967"><font color=#000080><tt>javax.swing.event</tt></font></a></a>).
Um auf dieses Ereignis zu reagieren, ist das Interface <a name="ixa102701"><a href="index_c.html#ixb101993"><font color=#000080><tt>ChangeListener</tt></font></a></a>
zu implementieren und das implementierende Objekt durch Aufruf von
<a name="ixa102702"><a href="index_a.html#ixb101994"><font color=#000080><tt>addChangeListener</tt></font></a></a>
zu registrieren. Wie bei <a href="index_j.html#ixb101779"><font color=#000080><tt>JScrollPane</tt></font></a>
kann mit <a name="ixa102703"><a href="index_g.html#ixb101995"><font color=#000080><tt>getValueIsAdjusting</tt></font></a></a>
festgestellt werden, ob die Änderung Bestandteil einer Kette
von Wertänderungen ist oder ob sie einzeln aufgetreten ist.
<p>
Das folgende Programm zeigt ein zu <a href="k100241.html#jscrollbarexample">Listing 37.12</a>
äquivalentes Beispiel, das zwei <a href="index_j.html#ixb101984"><font color=#000080><tt>JSlider</tt></font></a>
anstelle der Scrollbars verwendet.
<a name="listingid037013"></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">/* Listing3713.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> javax.swing.*;
<font color="#555555">006 </font><font color="#0000AA">import</font> javax.swing.border.*;
<font color="#555555">007 </font><font color="#0000AA">import</font> javax.swing.event.*;
<font color="#555555">008 </font>
<font color="#555555">009 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> Listing3713
<font color="#555555">010 </font><font color="#0000AA">extends</font> JFrame
<font color="#555555">011 </font><font color="#0000AA">implements</font> ChangeListener
<font color="#555555">012 </font>{
<font color="#555555">013 </font> <font color="#0000AA">private</font> JPanel coloredPanel;
<font color="#555555">014 </font> <font color="#0000AA">private</font> JSlider slEast;
<font color="#555555">015 </font> <font color="#0000AA">private</font> JSlider slSouth;
<font color="#555555">016 </font> <font color="#0000AA">private</font> <font color="#006699">int</font> blue = 0;
<font color="#555555">017 </font> <font color="#0000AA">private</font> <font color="#006699">int</font> red = 0;
<font color="#555555">018 </font>
<font color="#555555">019 </font> <font color="#0000AA">public</font> Listing3713()
<font color="#555555">020 </font> {
<font color="#555555">021 </font> <font color="#006699">super</font>(<font color="#0000FF">"JSlider"</font>);
<font color="#555555">022 </font> addWindowListener(<font color="#0000AA">new</font> WindowClosingAdapter(<font color="#006699">true</font>));
<font color="#555555">023 </font> Container cp = getContentPane();
<font color="#555555">024 </font> <font color="#00AA00">//Vertikaler Schieberegler</font>
<font color="#555555">025 </font> slEast = <font color="#0000AA">new</font> JSlider(JSlider.VERTICAL, 0, 255, 0);
<font color="#555555">026 </font> slEast.setMajorTickSpacing(50);
<font color="#555555">027 </font> slEast.setMinorTickSpacing(10);
<font color="#555555">028 </font> slEast.setPaintTicks(<font color="#006699">true</font>);
<font color="#555555">029 </font> slEast.setPaintLabels(<font color="#006699">true</font>);
<font color="#555555">030 </font> slEast.addChangeListener(<font color="#006699">this</font>);
<font color="#555555">031 </font> cp.add(slEast, BorderLayout.EAST);
<font color="#555555">032 </font> <font color="#00AA00">//Horizontaler Schieberegler</font>
<font color="#555555">033 </font> slSouth = <font color="#0000AA">new</font> JSlider(JSlider.HORIZONTAL, 0, 255, 0);
<font color="#555555">034 </font> slSouth.setMajorTickSpacing(100);
<font color="#555555">035 </font> slSouth.setMinorTickSpacing(25);
<font color="#555555">036 </font> slSouth.setPaintTicks(<font color="#006699">true</font>);
<font color="#555555">037 </font> slSouth.setPaintLabels(<font color="#006699">true</font>);
<font color="#555555">038 </font> slSouth.setSnapToTicks(<font color="#006699">true</font>);
<font color="#555555">039 </font> slSouth.addChangeListener(<font color="#006699">this</font>);
<font color="#555555">040 </font> cp.add(slSouth, BorderLayout.SOUTH);
<font color="#555555">041 </font> <font color="#00AA00">//Farbiges Panel</font>
<font color="#555555">042 </font> coloredPanel = <font color="#0000AA">new</font> JPanel();
<font color="#555555">043 </font> coloredPanel.setBackground(<font color="#0000AA">new</font> Color(red, 0, blue));
<font color="#555555">044 </font> cp.add(coloredPanel, BorderLayout.CENTER);
<font color="#555555">045 </font> }
<font color="#555555">046 </font>
<font color="#555555">047 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> stateChanged(ChangeEvent event)
<font color="#555555">048 </font> {
<font color="#555555">049 </font> JSlider sl = (JSlider)event.getSource();
<font color="#555555">050 </font> <font color="#0000AA">if</font> (sl == slEast) {
<font color="#555555">051 </font> blue = sl.getValue();
<font color="#555555">052 </font> } <font color="#0000AA">else</font> {
<font color="#555555">053 </font> red = sl.getValue();
<font color="#555555">054 </font> }
<font color="#555555">055 </font> coloredPanel.setBackground(<font color="#0000AA">new</font> Color(red, 0, blue));
<font color="#555555">056 </font> <font color="#0000AA">if</font> (!sl.getValueIsAdjusting()) {
<font color="#555555">057 </font> System.out.println(<font color="#0000FF">"("</font> + red + <font color="#0000FF">",0,"</font> + blue + <font color="#0000FF">")"</font>);
<font color="#555555">058 </font> }
<font color="#555555">059 </font> }
<font color="#555555">060 </font>
<font color="#555555">061 </font> <font color="#0000AA">public</font> <font color="#0000AA">static</font> <font color="#006699">void</font> main(String[] args)
<font color="#555555">062 </font> {
<font color="#555555">063 </font> Listing3713 frame = <font color="#0000AA">new</font> Listing3713();
<font color="#555555">064 </font> frame.setLocation(100, 100);
<font color="#555555">065 </font> frame.setSize(300, 250);
<font color="#555555">066 </font> frame.setVisible(<font color="#006699">true</font>);
<font color="#555555">067 </font> }
<font color="#555555">068 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/Listing3713.java"><font color="#000055" size=-1>Listing3713.java</font></a></td>
</tr>
</table>
<i>
Listing 37.13: Die Klasse JSlider</i></p>
<p>
Das Programm erzeugt einen horizontalen und vertikalen Slider, dessen
Wertebereich jeweils von 0 bis 255 reicht. Beide werden mit Skalenmarken
und Beschriftungen versehen, der horizontale Slider rastet auf den
Skalenmarkierungen ein. Bei jeder Änderung wird <a name="ixa102704"><a href="index_s.html#ixb101996"><font color=#000080><tt>stateChanged</tt></font></a></a>
aufgerufen und der aktuelle Sliderwert einer der beiden Farbvariablen
zugewiesen. Anschließend wird der Hintergrund des farbigen Panels
verändert und gegebenenfalls der Farbwert auf der Konsole ausgegeben.
<p>
Die Programmausgabe ist:
<p>
<a name="imageid037011"></a>
<img src="images/JSlider1.gif">
<p>
<p><i>
Abbildung 37.11: Die Klasse JSlider</i></p>
<!-- Section -->
<a name="sectlevel3id037004003"></a>
<h3>37.4.3 JProgressBar </h3>
<p>
Ein weiteres Hilfsmittel zur Darstellung von kontinuierlichen Werten
ist die Klasse <a name="ixa102705"><a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a></a>.
Sie stellt eine Fortschrittsanzeige dar, wie sie auch das Betriebssystem
oder ein Installationsprogramm bei längeren Kopiervorgängen
anzeigt. Die Fortschrittsanzeige hat einen aktuellen Wert, der grafisch
mit einer Füllstandsanzeige dargestellt wird und sich schrittweise
vom Minimal- zum Maximalwert fortentwickelt.
<p>
Die wichtigsten Konstruktoren von <a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a>
sind:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public JProgressBar(int orient)
public JProgressBar(int min, int max)
public JProgressBar(int orient, int min, int max)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JProgressBar.html" onClick="this.href=getApiDoc('javax.swing.JProgressBar')"><font color="#660066" size=-1>javax.swing.JProgressBar</font></a></td>
</tr>
</table>
<p>
Der Parameter <font color="#000077"><tt>orient</tt></font> gibt die
Orientierung der Fortschrittsanzeige an, sie kann wahlweise <a href="index_h.html#ixb101624"><font color=#000080><tt>HORIZONTAL</tt></font></a>
oder <a href="index_v.html#ixb101625"><font color=#000080><tt>VERTICAL</tt></font></a>
sein. Wird sie ausgelassen, erzeugt Swing eine horizontale Darstellung.
<font color="#000077"><tt>min</tt></font> und <font color="#000077"><tt>max</tt></font>
geben die untere und obere Grenze des Wertebereichs an. Wenn sie ausgelassen
werden, wird eine Voreinstellung von 0 bzw. 100 verwendet.
<p>
Standardmäßig wird die Fortschrittsanzeige ohne Beschriftung
dargestellt. Durch Aufruf von <a name="ixa102706"><a href="index_s.html#ixb101998"><font color=#000080><tt>setStringPainted</tt></font></a></a>
und Übergabe von <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
kann ein prozentualer Fortschrittswert angezeigt werden:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void setStringPainted(boolean b)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JProgressBar.html" onClick="this.href=getApiDoc('javax.swing.JProgressBar')"><font color="#660066" size=-1>javax.swing.JProgressBar</font></a></td>
</tr>
</table>
<p>
Der Wert (und mit ihm die grafische Darstellung des Fortschritts)
kann durch Aufruf von <a name="ixa102707"><a href="index_s.html#ixb101686"><font color=#000080><tt>setValue</tt></font></a></a>
verändert werden. Mit <a name="ixa102708"><a href="index_g.html#ixb100752"><font color=#000080><tt>getValue</tt></font></a></a>
kann dieser auch abgefragt werden:
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void setValue(int n)
public int getValue()
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JProgressBar.html" onClick="this.href=getApiDoc('javax.swing.JProgressBar')"><font color="#660066" size=-1>javax.swing.JProgressBar</font></a></td>
</tr>
</table>
<p>
Das folgende Programm zeigt eine einfache Anwendung von <a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a>.
Es enthält eine Fortschrittsanzeige mit einem Wertebereich von
0 bis 100 und einem initialen Wert von 0. Durch Betätigen des
Buttons "Weiter" wird der Wert um fünf erhöht. Hat der Wert
hundert erreicht, wird er wieder auf null gesetzt.
<a name="listingid037014"></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">/* Listing3714.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> javax.swing.*;
<font color="#555555">006 </font>
<font color="#555555">007 </font><font color="#0000AA">public</font> <font color="#0000AA">class</font> Listing3714
<font color="#555555">008 </font><font color="#0000AA">extends</font> JFrame
<font color="#555555">009 </font><font color="#0000AA">implements</font> ActionListener
<font color="#555555">010 </font>{
<font color="#555555">011 </font> <font color="#0000AA">private</font> JProgressBar pb;
<font color="#555555">012 </font> <font color="#0000AA">private</font> <font color="#006699">int</font> value = 0;
<font color="#555555">013 </font>
<font color="#555555">014 </font> <font color="#0000AA">public</font> Listing3714()
<font color="#555555">015 </font> {
<font color="#555555">016 </font> <font color="#006699">super</font>(<font color="#0000FF">"JProgressBar"</font>);
<font color="#555555">017 </font> addWindowListener(<font color="#0000AA">new</font> WindowClosingAdapter(<font color="#006699">true</font>));
<font color="#555555">018 </font> Container cp = getContentPane();
<font color="#555555">019 </font> <font color="#00AA00">//Fortschrittsanzeige</font>
<font color="#555555">020 </font> pb = <font color="#0000AA">new</font> JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
<font color="#555555">021 </font> pb.setStringPainted(<font color="#006699">true</font>);
<font color="#555555">022 </font> cp.add(pb, BorderLayout.NORTH);
<font color="#555555">023 </font> <font color="#00AA00">//Weiter-Button</font>
<font color="#555555">024 </font> JButton button = <font color="#0000AA">new</font> JButton(<font color="#0000FF">"Weiter"</font>);
<font color="#555555">025 </font> button.addActionListener(<font color="#006699">this</font>);
<font color="#555555">026 </font> cp.add(button, BorderLayout.SOUTH);
<font color="#555555">027 </font> }
<font color="#555555">028 </font>
<font color="#555555">029 </font> <font color="#0000AA">public</font> <font color="#006699">void</font> actionPerformed(ActionEvent event)
<font color="#555555">030 </font> {
<font color="#555555">031 </font> value = (value >= 100 ? 0 : value + 5);
<font color="#555555">032 </font> pb.setValue(value);
<font color="#555555">033 </font> }
<font color="#555555">034 </font>
<font color="#555555">035 </font> <font color="#0000AA">public</font> <font color="#0000AA">static</font> <font color="#006699">void</font> main(String[] args)
<font color="#555555">036 </font> {
<font color="#555555">037 </font> Listing3714 frame = <font color="#0000AA">new</font> Listing3714();
<font color="#555555">038 </font> frame.setLocation(100, 100);
<font color="#555555">039 </font> frame.setSize(300, 150);
<font color="#555555">040 </font> frame.setVisible(<font color="#006699">true</font>);
<font color="#555555">041 </font> }
<font color="#555555">042 </font>}</pre>
</font>
</td>
<td valign=top align=right>
<a href="../examples/Listing3714.java"><font color="#000055" size=-1>Listing3714.java</font></a></td>
</tr>
</table>
<i>
Listing 37.14: Die Klasse JProgressBar</i></p>
<p>
Die Programmausgabe ist:
<p>
<a name="imageid037012"></a>
<img src="images/JProgressBar1.gif">
<p>
<p><i>
Abbildung 37.12: Die Klasse JProgressBar</i></p>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr>
<td width=1 align=left valign=top bgcolor="#CC0000"><img src="trp1_1.gif"></td>
<td><img src="trp1_1.gif" width=1></td>
<td width=1 align=left valign=top bgcolor="#CC0000"><img src="trp1_1.gif"></td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top width=1000>
<p>
Langdauernde Aktivitäten, die durch eine Fortschrittsanzeige
verfolgt werden, laufen oft in einem eigenen Thread ab. Eine (im negativen
Sinne) sehr wichtige Eigenschaft der Swing-Dialogelemente ist, dass
sie nicht thread-sicher sind<a name="ixa102709"></a>. Nachdem sie
einmal auf dem Bildschirm sichtbar gemacht wurden, dürfen Änderungen,
die die Darstellung der Komponente verändern könnten, nur
noch aus dem GUI-Thread heraus vorgenommen werden. Anderen Threads
sind sie dagegen nicht mehr erlaubt. Der Aufruf von <a href="index_s.html#ixb101686"><font color=#000080><tt>setValue</tt></font></a>
im Beispielprogramm war also genau deshalb zulässig, weil er
aus der Methode <a href="index_a.html#ixb101474"><font color=#000080><tt>actionPerformed</tt></font></a>
heraus erfolgte (diese wird vom GUI-Thread aufgerufen). Ein Aufruf
aus <a href="index_m.html#ixb100150"><font color=#000080><tt>main</tt></font></a>
oder aus einem eigenen Thread wäre dagegen nicht erlaubt gewesen.
Andere Threads dürfen nur noch solche Methoden aufrufen, die
lediglich Grafik-Events erzeugen (beispielsweise <a href="index_r.html#ixb101509"><font color=#000080><tt>repaint</tt></font></a>).</td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top>
<table border=0 cellspacing=0 cellpadding=1 width=100% bgcolor="#CC0000">
<tr>
<td><font color="#FFFFFF"> Warnung </font></td>
</tr>
</table>
</td>
<td width=1 align=left valign=top bgcolor="#CC0000"><img src="trp1_1.gif"></td>
</tr>
</table>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr>
<td width=1 align=left valign=top bgcolor="#FF9900"><img src="trp1_1.gif"></td>
<td><img src="trp1_1.gif" width=1></td>
<td width=1 align=left valign=top bgcolor="#FF9900"><img src="trp1_1.gif"></td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top width=1000>
<p>
Seit dem JDK 1.4 gibt es die Möglichkeit, einen <a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a>
mit einer dauerhaft ablaufenden Animation zu erzeugen. Dies ist immer
dann nützlich, wenn die Größe der zu erledigenden
Aufgabe bei der Konstruktion des <a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a>
noch nicht bekannt ist. Die Fortschrittsanzeige zeigt dann lediglich
an, <i>dass</i> eine Aktivität gerade läuft, sagt aber nichts
darüber aus, wie lange sie noch andauern wird. Folgende Methoden
sind dazu im JDK 1.4 hinzugekommen:</td>
<td><img src="trp1_1.gif" width=2></td>
<td valign=top>
<table border=0 cellspacing=0 cellpadding=1 width=100% bgcolor="#FF9900">
<tr>
<td><font color="#FFFFFF"> JDK1.1-6.0 </font></td>
</tr>
</table>
</td>
<td width=1 align=left valign=top bgcolor="#FF9900"><img src="trp1_1.gif"></td>
</tr>
</table>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public void setIndeterminate(boolean newValue);
public boolean isIndeterminate()
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/javax/swing/JProgressBar.html" onClick="this.href=getApiDoc('javax.swing.JProgressBar')"><font color="#660066" size=-1>javax.swing.JProgressBar</font></a></td>
</tr>
</table>
<p>
Nach Aufruf von <a name="ixa102710"><a href="index_s.html#ixb101999"><font color=#000080><tt>setIndeterminate</tt></font></a></a>
und Übergabe von <a href="index_t.html#ixb100233"><font color=#000080><tt>true</tt></font></a>
wird die Fortschrittsanzeige in den kontinuierlichen Modus versetzt.
Dann ist sie dauerhaft animiert, und der aktuelle Wert sowie das eingestellte
Minimum und Maximum werden ignoriert. Die Anwendung selbst braucht
sich um die Animation nicht zu kümmern, sie läuft automatisch.
Durch Aufruf von <a href="index_s.html#ixb101999"><font color=#000080><tt>setIndeterminate</tt></font></a>
mit <a href="index_f.html#ixb100234"><font color=#000080><tt>false</tt></font></a>
als Argument kann der <a href="index_j.html#ixb101997"><font color=#000080><tt>JProgressBar</tt></font></a>
in den Standardmodus zurückgesetzt werden. <a name="ixa102711"><a href="index_i.html#ixb102000"><font color=#000080><tt>isIndeterminate</tt></font></a></a>
liefert den aktuellen Wert dieser Eigenschaft.
<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="k100237.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100240.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100242.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100243.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>
|