Repository navigation
Expand file tree
/
Copy pathButton.html
More file actions
875 lines (872 loc) · 56.7 KB
/
Copy pathButton.html
File metadata and controls
875 lines (872 loc) · 56.7 KB
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
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>Button (Java SE 12 & JDK 12 )</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="java.awt.Button class">
<meta name="keywords" content="addNotify()">
<meta name="keywords" content="getLabel()">
<meta name="keywords" content="setLabel()">
<meta name="keywords" content="setActionCommand()">
<meta name="keywords" content="getActionCommand()">
<meta name="keywords" content="addActionListener()">
<meta name="keywords" content="removeActionListener()">
<meta name="keywords" content="getActionListeners()">
<meta name="keywords" content="getListeners()">
<meta name="keywords" content="processEvent()">
<meta name="keywords" content="processActionEvent()">
<meta name="keywords" content="paramString()">
<meta name="keywords" content="getAccessibleContext()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Button (Java SE 12 & JDK 12 )";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Button.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 & JDK 12</strong> </div></div>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="moduleLabelInType">Module</span> <a href="../../module-summary.html">java.desktop</a></div>
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">java.awt</a></div>
<h2 title="Class Button" class="title">Class Button</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="../../../java.base/java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="Component.html" title="class in java.awt">java.awt.Component</a></li>
<li>
<ul class="inheritance">
<li>java.awt.Button</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="image/ImageObserver.html" title="interface in java.awt.image">ImageObserver</a></code>, <code><a href="MenuContainer.html" title="interface in java.awt">MenuContainer</a></code>, <code><a href="../../../java.base/java/io/Serializable.html" title="interface in java.io">Serializable</a></code>, <code><a href="../../javax/accessibility/Accessible.html" title="interface in javax.accessibility">Accessible</a></code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">Button</span>
extends <a href="Component.html" title="class in java.awt">Component</a>
implements <a href="../../javax/accessibility/Accessible.html" title="interface in javax.accessibility">Accessible</a></pre>
<div class="block">This class creates a labeled button. The application can cause
some action to happen when the button is pushed. This image
depicts three views of a "<code>Quit</code>" button as it appears
under the Solaris operating system:
<p>
<img src="doc-files/Button-1.gif" alt="The following context describes the graphic" style="float:center; margin: 7px 10px;">
<p>
The first view shows the button as it appears normally.
The second view shows the button
when it has input focus. Its outline is darkened to let the
user know that it is an active object. The third view shows the
button when the user clicks the mouse over the button, and thus
requests that an action be performed.
<p>
The gesture of clicking on a button with the mouse
is associated with one instance of <code>ActionEvent</code>,
which is sent out when the mouse is both pressed and released
over the button. If an application is interested in knowing
when the button has been pressed but not released, as a separate
gesture, it can specialize <code>processMouseEvent</code>,
or it can register itself as a listener for mouse events by
calling <code>addMouseListener</code>. Both of these methods are
defined by <code>Component</code>, the abstract superclass of
all components.
<p>
When a button is pressed and released, AWT sends an instance
of <code>ActionEvent</code> to the button, by calling
<code>processEvent</code> on the button. The button's
<code>processEvent</code> method receives all events
for the button; it passes an action event along by
calling its own <code>processActionEvent</code> method.
The latter method passes the action event on to any action
listeners that have registered an interest in action
events generated by this button.
<p>
If an application wants to perform some action based on
a button being pressed and released, it should implement
<code>ActionListener</code> and register the new listener
to receive events from this button, by calling the button's
<code>addActionListener</code> method. The application can
make use of the button's action command as a messaging protocol.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="event/ActionEvent.html" title="class in java.awt.event"><code>ActionEvent</code></a>,
<a href="event/ActionListener.html" title="interface in java.awt.event"><code>ActionListener</code></a>,
<a href="Component.html#processMouseEvent(java.awt.event.MouseEvent)"><code>Component.processMouseEvent(java.awt.event.MouseEvent)</code></a>,
<a href="Component.html#addMouseListener(java.awt.event.MouseListener)"><code>Component.addMouseListener(java.awt.event.MouseListener)</code></a>,
<a href="../../../serialized-form.html#java.awt.Button">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<div class="memberSummary">
<table>
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>protected class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="Button.AccessibleAWTButton.html" title="class in java.awt">Button.AccessibleAWTButton</a></span></code></th>
<td class="colLast">
<div class="block">This class implements accessibility support for the
<code>Button</code> class.</div>
</td>
</tr>
</tbody>
</table>
</div>
<ul class="blockList">
<li class="blockList"><a id="nested.classes.inherited.from.class.java.awt.Component">
<!-- -->
</a>
<h3>Nested classes/interfaces declared in class java.awt.<a href="Component.html" title="class in java.awt">Component</a></h3>
<code><a href="Component.AccessibleAWTComponent.html" title="class in java.awt">Component.AccessibleAWTComponent</a>, <a href="Component.BaselineResizeBehavior.html" title="enum in java.awt">Component.BaselineResizeBehavior</a>, <a href="Component.BltBufferStrategy.html" title="class in java.awt">Component.BltBufferStrategy</a>, <a href="Component.FlipBufferStrategy.html" title="class in java.awt">Component.FlipBufferStrategy</a></code></li>
</ul>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.java.awt.Component">
<!-- -->
</a>
<h3>Fields declared in class java.awt.<a href="Component.html" title="class in java.awt">Component</a></h3>
<code><a href="Component.html#accessibleContext">accessibleContext</a>, <a href="Component.html#BOTTOM_ALIGNMENT">BOTTOM_ALIGNMENT</a>, <a href="Component.html#CENTER_ALIGNMENT">CENTER_ALIGNMENT</a>, <a href="Component.html#LEFT_ALIGNMENT">LEFT_ALIGNMENT</a>, <a href="Component.html#RIGHT_ALIGNMENT">RIGHT_ALIGNMENT</a>, <a href="Component.html#TOP_ALIGNMENT">TOP_ALIGNMENT</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.java.awt.image.ImageObserver">
<!-- -->
</a>
<h3>Fields declared in interface java.awt.image.<a href="image/ImageObserver.html" title="interface in java.awt.image">ImageObserver</a></h3>
<code><a href="image/ImageObserver.html#ABORT">ABORT</a>, <a href="image/ImageObserver.html#ALLBITS">ALLBITS</a>, <a href="image/ImageObserver.html#ERROR">ERROR</a>, <a href="image/ImageObserver.html#FRAMEBITS">FRAMEBITS</a>, <a href="image/ImageObserver.html#HEIGHT">HEIGHT</a>, <a href="image/ImageObserver.html#PROPERTIES">PROPERTIES</a>, <a href="image/ImageObserver.html#SOMEBITS">SOMEBITS</a>, <a href="image/ImageObserver.html#WIDTH">WIDTH</a></code></li>
</ul>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<div class="memberSummary">
<table>
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">Button</a></span>()</code></th>
<td class="colLast">
<div class="block">Constructs a button with an empty string for its label.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">Button</a></span>​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> label)</code></th>
<td class="colLast">
<div class="block">Constructs a button with the specified label.</div>
</td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<div class="memberSummary">
<div role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="memberSummary_tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="activeTableTab">All Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t2" class="tableTab" onclick="show(2);">Instance Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t4" class="tableTab" onclick="show(8);">Concrete Methods</button></div>
<div id="memberSummary_tabpanel" role="tabpanel">
<table aria-labelledby="t0">
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor" id="i0">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addActionListener(java.awt.event.ActionListener)">addActionListener</a></span>​(<a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a> l)</code></th>
<td class="colLast">
<div class="block">Adds the specified action listener to receive action events from
this button.</div>
</td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addNotify()">addNotify</a></span>()</code></th>
<td class="colLast">
<div class="block">Creates the peer of the button.</div>
</td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code><a href="../../javax/accessibility/AccessibleContext.html" title="class in javax.accessibility">AccessibleContext</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAccessibleContext()">getAccessibleContext</a></span>()</code></th>
<td class="colLast">
<div class="block">Gets the <code>AccessibleContext</code> associated with
this <code>Button</code>.</div>
</td>
</tr>
<tr class="rowColor" id="i3">
<td class="colFirst"><code><a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getActionCommand()">getActionCommand</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the command name of the action event fired by this button.</div>
</td>
</tr>
<tr class="altColor" id="i4">
<td class="colFirst"><code><a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a>[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getActionListeners()">getActionListeners</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns an array of all the action listeners
registered on this button.</div>
</td>
</tr>
<tr class="rowColor" id="i5">
<td class="colFirst"><code><a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLabel()">getLabel</a></span>()</code></th>
<td class="colLast">
<div class="block">Gets the label of this button.</div>
</td>
</tr>
<tr class="altColor" id="i6">
<td class="colFirst"><code><T extends <a href="../../../java.base/java/util/EventListener.html" title="interface in java.util">EventListener</a>><br>T[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getListeners(java.lang.Class)">getListeners</a></span>​(<a href="../../../java.base/java/lang/Class.html" title="class in java.lang">Class</a><T> listenerType)</code></th>
<td class="colLast">
<div class="block">Returns an array of all the objects currently registered
as <code><em>Foo</em>Listener</code>s
upon this <code>Button</code>.</div>
</td>
</tr>
<tr class="rowColor" id="i7">
<td class="colFirst"><code>protected <a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#paramString()">paramString</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a string representing the state of this <code>Button</code>.</div>
</td>
</tr>
<tr class="altColor" id="i8">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#processActionEvent(java.awt.event.ActionEvent)">processActionEvent</a></span>​(<a href="event/ActionEvent.html" title="class in java.awt.event">ActionEvent</a> e)</code></th>
<td class="colLast">
<div class="block">Processes action events occurring on this button
by dispatching them to any registered
<code>ActionListener</code> objects.</div>
</td>
</tr>
<tr class="rowColor" id="i9">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#processEvent(java.awt.AWTEvent)">processEvent</a></span>​(<a href="AWTEvent.html" title="class in java.awt">AWTEvent</a> e)</code></th>
<td class="colLast">
<div class="block">Processes events on this button.</div>
</td>
</tr>
<tr class="altColor" id="i10">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeActionListener(java.awt.event.ActionListener)">removeActionListener</a></span>​(<a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a> l)</code></th>
<td class="colLast">
<div class="block">Removes the specified action listener so that it no longer
receives action events from this button.</div>
</td>
</tr>
<tr class="rowColor" id="i11">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setActionCommand(java.lang.String)">setActionCommand</a></span>​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> command)</code></th>
<td class="colLast">
<div class="block">Sets the command name for the action event fired
by this button.</div>
</td>
</tr>
<tr class="altColor" id="i12">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setLabel(java.lang.String)">setLabel</a></span>​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> label)</code></th>
<td class="colLast">
<div class="block">Sets the button's label to be the specified string.</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.awt.Component">
<!-- -->
</a>
<h3>Methods declared in class java.awt.<a href="Component.html" title="class in java.awt">Component</a></h3>
<code><a href="Component.html#action(java.awt.Event,java.lang.Object)">action</a>, <a href="Component.html#add(java.awt.PopupMenu)">add</a>, <a href="Component.html#addComponentListener(java.awt.event.ComponentListener)">addComponentListener</a>, <a href="Component.html#addFocusListener(java.awt.event.FocusListener)">addFocusListener</a>, <a href="Component.html#addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)">addHierarchyBoundsListener</a>, <a href="Component.html#addHierarchyListener(java.awt.event.HierarchyListener)">addHierarchyListener</a>, <a href="Component.html#addInputMethodListener(java.awt.event.InputMethodListener)">addInputMethodListener</a>, <a href="Component.html#addKeyListener(java.awt.event.KeyListener)">addKeyListener</a>, <a href="Component.html#addMouseListener(java.awt.event.MouseListener)">addMouseListener</a>, <a href="Component.html#addMouseMotionListener(java.awt.event.MouseMotionListener)">addMouseMotionListener</a>, <a href="Component.html#addMouseWheelListener(java.awt.event.MouseWheelListener)">addMouseWheelListener</a>, <a href="Component.html#addPropertyChangeListener(java.beans.PropertyChangeListener)">addPropertyChangeListener</a>, <a href="Component.html#addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)">addPropertyChangeListener</a>, <a href="Component.html#applyComponentOrientation(java.awt.ComponentOrientation)">applyComponentOrientation</a>, <a href="Component.html#areFocusTraversalKeysSet(int)">areFocusTraversalKeysSet</a>, <a href="Component.html#bounds()">bounds</a>, <a href="Component.html#checkImage(java.awt.Image,int,int,java.awt.image.ImageObserver)">checkImage</a>, <a href="Component.html#checkImage(java.awt.Image,java.awt.image.ImageObserver)">checkImage</a>, <a href="Component.html#coalesceEvents(java.awt.AWTEvent,java.awt.AWTEvent)">coalesceEvents</a>, <a href="Component.html#contains(int,int)">contains</a>, <a href="Component.html#contains(java.awt.Point)">contains</a>, <a href="Component.html#createImage(int,int)">createImage</a>, <a href="Component.html#createImage(java.awt.image.ImageProducer)">createImage</a>, <a href="Component.html#createVolatileImage(int,int)">createVolatileImage</a>, <a href="Component.html#createVolatileImage(int,int,java.awt.ImageCapabilities)">createVolatileImage</a>, <a href="Component.html#deliverEvent(java.awt.Event)">deliverEvent</a>, <a href="Component.html#disable()">disable</a>, <a href="Component.html#disableEvents(long)">disableEvents</a>, <a href="Component.html#dispatchEvent(java.awt.AWTEvent)">dispatchEvent</a>, <a href="Component.html#doLayout()">doLayout</a>, <a href="Component.html#enable()">enable</a>, <a href="Component.html#enable(boolean)">enable</a>, <a href="Component.html#enableEvents(long)">enableEvents</a>, <a href="Component.html#enableInputMethods(boolean)">enableInputMethods</a>, <a href="Component.html#firePropertyChange(java.lang.String,boolean,boolean)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,byte,byte)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,char,char)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,double,double)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,float,float)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,int,int)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,long,long)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,short,short)">firePropertyChange</a>, <a href="Component.html#firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)">firePropertyChange</a>, <a href="Component.html#getAlignmentX()">getAlignmentX</a>, <a href="Component.html#getAlignmentY()">getAlignmentY</a>, <a href="Component.html#getBackground()">getBackground</a>, <a href="Component.html#getBaseline(int,int)">getBaseline</a>, <a href="Component.html#getBaselineResizeBehavior()">getBaselineResizeBehavior</a>, <a href="Component.html#getBounds()">getBounds</a>, <a href="Component.html#getBounds(java.awt.Rectangle)">getBounds</a>, <a href="Component.html#getColorModel()">getColorModel</a>, <a href="Component.html#getComponentAt(int,int)">getComponentAt</a>, <a href="Component.html#getComponentAt(java.awt.Point)">getComponentAt</a>, <a href="Component.html#getComponentListeners()">getComponentListeners</a>, <a href="Component.html#getComponentOrientation()">getComponentOrientation</a>, <a href="Component.html#getCursor()">getCursor</a>, <a href="Component.html#getDropTarget()">getDropTarget</a>, <a href="Component.html#getFocusCycleRootAncestor()">getFocusCycleRootAncestor</a>, <a href="Component.html#getFocusListeners()">getFocusListeners</a>, <a href="Component.html#getFocusTraversalKeys(int)">getFocusTraversalKeys</a>, <a href="Component.html#getFocusTraversalKeysEnabled()">getFocusTraversalKeysEnabled</a>, <a href="Component.html#getFont()">getFont</a>, <a href="Component.html#getFontMetrics(java.awt.Font)">getFontMetrics</a>, <a href="Component.html#getForeground()">getForeground</a>, <a href="Component.html#getGraphics()">getGraphics</a>, <a href="Component.html#getGraphicsConfiguration()">getGraphicsConfiguration</a>, <a href="Component.html#getHeight()">getHeight</a>, <a href="Component.html#getHierarchyBoundsListeners()">getHierarchyBoundsListeners</a>, <a href="Component.html#getHierarchyListeners()">getHierarchyListeners</a>, <a href="Component.html#getIgnoreRepaint()">getIgnoreRepaint</a>, <a href="Component.html#getInputContext()">getInputContext</a>, <a href="Component.html#getInputMethodListeners()">getInputMethodListeners</a>, <a href="Component.html#getInputMethodRequests()">getInputMethodRequests</a>, <a href="Component.html#getKeyListeners()">getKeyListeners</a>, <a href="Component.html#getLocale()">getLocale</a>, <a href="Component.html#getLocation()">getLocation</a>, <a href="Component.html#getLocation(java.awt.Point)">getLocation</a>, <a href="Component.html#getLocationOnScreen()">getLocationOnScreen</a>, <a href="Component.html#getMaximumSize()">getMaximumSize</a>, <a href="Component.html#getMinimumSize()">getMinimumSize</a>, <a href="Component.html#getMouseListeners()">getMouseListeners</a>, <a href="Component.html#getMouseMotionListeners()">getMouseMotionListeners</a>, <a href="Component.html#getMousePosition()">getMousePosition</a>, <a href="Component.html#getMouseWheelListeners()">getMouseWheelListeners</a>, <a href="Component.html#getName()">getName</a>, <a href="Component.html#getParent()">getParent</a>, <a href="Component.html#getPreferredSize()">getPreferredSize</a>, <a href="Component.html#getPropertyChangeListeners()">getPropertyChangeListeners</a>, <a href="Component.html#getPropertyChangeListeners(java.lang.String)">getPropertyChangeListeners</a>, <a href="Component.html#getSize()">getSize</a>, <a href="Component.html#getSize(java.awt.Dimension)">getSize</a>, <a href="Component.html#getToolkit()">getToolkit</a>, <a href="Component.html#getTreeLock()">getTreeLock</a>, <a href="Component.html#getWidth()">getWidth</a>, <a href="Component.html#getX()">getX</a>, <a href="Component.html#getY()">getY</a>, <a href="Component.html#gotFocus(java.awt.Event,java.lang.Object)">gotFocus</a>, <a href="Component.html#handleEvent(java.awt.Event)">handleEvent</a>, <a href="Component.html#hasFocus()">hasFocus</a>, <a href="Component.html#hide()">hide</a>, <a href="Component.html#imageUpdate(java.awt.Image,int,int,int,int,int)">imageUpdate</a>, <a href="Component.html#inside(int,int)">inside</a>, <a href="Component.html#invalidate()">invalidate</a>, <a href="Component.html#isBackgroundSet()">isBackgroundSet</a>, <a href="Component.html#isCursorSet()">isCursorSet</a>, <a href="Component.html#isDisplayable()">isDisplayable</a>, <a href="Component.html#isDoubleBuffered()">isDoubleBuffered</a>, <a href="Component.html#isEnabled()">isEnabled</a>, <a href="Component.html#isFocusable()">isFocusable</a>, <a href="Component.html#isFocusCycleRoot(java.awt.Container)">isFocusCycleRoot</a>, <a href="Component.html#isFocusOwner()">isFocusOwner</a>, <a href="Component.html#isFocusTraversable()">isFocusTraversable</a>, <a href="Component.html#isFontSet()">isFontSet</a>, <a href="Component.html#isForegroundSet()">isForegroundSet</a>, <a href="Component.html#isLightweight()">isLightweight</a>, <a href="Component.html#isMaximumSizeSet()">isMaximumSizeSet</a>, <a href="Component.html#isMinimumSizeSet()">isMinimumSizeSet</a>, <a href="Component.html#isOpaque()">isOpaque</a>, <a href="Component.html#isPreferredSizeSet()">isPreferredSizeSet</a>, <a href="Component.html#isShowing()">isShowing</a>, <a href="Component.html#isValid()">isValid</a>, <a href="Component.html#isVisible()">isVisible</a>, <a href="Component.html#keyDown(java.awt.Event,int)">keyDown</a>, <a href="Component.html#keyUp(java.awt.Event,int)">keyUp</a>, <a href="Component.html#layout()">layout</a>, <a href="Component.html#list()">list</a>, <a href="Component.html#list(java.io.PrintStream)">list</a>, <a href="Component.html#list(java.io.PrintStream,int)">list</a>, <a href="Component.html#list(java.io.PrintWriter)">list</a>, <a href="Component.html#list(java.io.PrintWriter,int)">list</a>, <a href="Component.html#locate(int,int)">locate</a>, <a href="Component.html#location()">location</a>, <a href="Component.html#lostFocus(java.awt.Event,java.lang.Object)">lostFocus</a>, <a href="Component.html#minimumSize()">minimumSize</a>, <a href="Component.html#mouseDown(java.awt.Event,int,int)">mouseDown</a>, <a href="Component.html#mouseDrag(java.awt.Event,int,int)">mouseDrag</a>, <a href="Component.html#mouseEnter(java.awt.Event,int,int)">mouseEnter</a>, <a href="Component.html#mouseExit(java.awt.Event,int,int)">mouseExit</a>, <a href="Component.html#mouseMove(java.awt.Event,int,int)">mouseMove</a>, <a href="Component.html#mouseUp(java.awt.Event,int,int)">mouseUp</a>, <a href="Component.html#move(int,int)">move</a>, <a href="Component.html#nextFocus()">nextFocus</a>, <a href="Component.html#paint(java.awt.Graphics)">paint</a>, <a href="Component.html#paintAll(java.awt.Graphics)">paintAll</a>, <a href="Component.html#postEvent(java.awt.Event)">postEvent</a>, <a href="Component.html#preferredSize()">preferredSize</a>, <a href="Component.html#prepareImage(java.awt.Image,int,int,java.awt.image.ImageObserver)">prepareImage</a>, <a href="Component.html#prepareImage(java.awt.Image,java.awt.image.ImageObserver)">prepareImage</a>, <a href="Component.html#print(java.awt.Graphics)">print</a>, <a href="Component.html#printAll(java.awt.Graphics)">printAll</a>, <a href="Component.html#processComponentEvent(java.awt.event.ComponentEvent)">processComponentEvent</a>, <a href="Component.html#processFocusEvent(java.awt.event.FocusEvent)">processFocusEvent</a>, <a href="Component.html#processHierarchyBoundsEvent(java.awt.event.HierarchyEvent)">processHierarchyBoundsEvent</a>, <a href="Component.html#processHierarchyEvent(java.awt.event.HierarchyEvent)">processHierarchyEvent</a>, <a href="Component.html#processInputMethodEvent(java.awt.event.InputMethodEvent)">processInputMethodEvent</a>, <a href="Component.html#processKeyEvent(java.awt.event.KeyEvent)">processKeyEvent</a>, <a href="Component.html#processMouseEvent(java.awt.event.MouseEvent)">processMouseEvent</a>, <a href="Component.html#processMouseMotionEvent(java.awt.event.MouseEvent)">processMouseMotionEvent</a>, <a href="Component.html#processMouseWheelEvent(java.awt.event.MouseWheelEvent)">processMouseWheelEvent</a>, <a href="Component.html#remove(java.awt.MenuComponent)">remove</a>, <a href="Component.html#removeComponentListener(java.awt.event.ComponentListener)">removeComponentListener</a>, <a href="Component.html#removeFocusListener(java.awt.event.FocusListener)">removeFocusListener</a>, <a href="Component.html#removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)">removeHierarchyBoundsListener</a>, <a href="Component.html#removeHierarchyListener(java.awt.event.HierarchyListener)">removeHierarchyListener</a>, <a href="Component.html#removeInputMethodListener(java.awt.event.InputMethodListener)">removeInputMethodListener</a>, <a href="Component.html#removeKeyListener(java.awt.event.KeyListener)">removeKeyListener</a>, <a href="Component.html#removeMouseListener(java.awt.event.MouseListener)">removeMouseListener</a>, <a href="Component.html#removeMouseMotionListener(java.awt.event.MouseMotionListener)">removeMouseMotionListener</a>, <a href="Component.html#removeMouseWheelListener(java.awt.event.MouseWheelListener)">removeMouseWheelListener</a>, <a href="Component.html#removeNotify()">removeNotify</a>, <a href="Component.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">removePropertyChangeListener</a>, <a href="Component.html#removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)">removePropertyChangeListener</a>, <a href="Component.html#repaint()">repaint</a>, <a href="Component.html#repaint(int,int,int,int)">repaint</a>, <a href="Component.html#repaint(long)">repaint</a>, <a href="Component.html#repaint(long,int,int,int,int)">repaint</a>, <a href="Component.html#requestFocus()">requestFocus</a>, <a href="Component.html#requestFocus(boolean)">requestFocus</a>, <a href="Component.html#requestFocus(boolean,java.awt.event.FocusEvent.Cause)">requestFocus</a>, <a href="Component.html#requestFocus(java.awt.event.FocusEvent.Cause)">requestFocus</a>, <a href="Component.html#requestFocusInWindow()">requestFocusInWindow</a>, <a href="Component.html#requestFocusInWindow(boolean)">requestFocusInWindow</a>, <a href="Component.html#requestFocusInWindow(java.awt.event.FocusEvent.Cause)">requestFocusInWindow</a>, <a href="Component.html#reshape(int,int,int,int)">reshape</a>, <a href="Component.html#resize(int,int)">resize</a>, <a href="Component.html#resize(java.awt.Dimension)">resize</a>, <a href="Component.html#revalidate()">revalidate</a>, <a href="Component.html#setBackground(java.awt.Color)">setBackground</a>, <a href="Component.html#setBounds(int,int,int,int)">setBounds</a>, <a href="Component.html#setBounds(java.awt.Rectangle)">setBounds</a>, <a href="Component.html#setComponentOrientation(java.awt.ComponentOrientation)">setComponentOrientation</a>, <a href="Component.html#setCursor(java.awt.Cursor)">setCursor</a>, <a href="Component.html#setDropTarget(java.awt.dnd.DropTarget)">setDropTarget</a>, <a href="Component.html#setEnabled(boolean)">setEnabled</a>, <a href="Component.html#setFocusable(boolean)">setFocusable</a>, <a href="Component.html#setFocusTraversalKeys(int,java.util.Set)">setFocusTraversalKeys</a>, <a href="Component.html#setFocusTraversalKeysEnabled(boolean)">setFocusTraversalKeysEnabled</a>, <a href="Component.html#setFont(java.awt.Font)">setFont</a>, <a href="Component.html#setForeground(java.awt.Color)">setForeground</a>, <a href="Component.html#setIgnoreRepaint(boolean)">setIgnoreRepaint</a>, <a href="Component.html#setLocale(java.util.Locale)">setLocale</a>, <a href="Component.html#setLocation(int,int)">setLocation</a>, <a href="Component.html#setLocation(java.awt.Point)">setLocation</a>, <a href="Component.html#setMaximumSize(java.awt.Dimension)">setMaximumSize</a>, <a href="Component.html#setMinimumSize(java.awt.Dimension)">setMinimumSize</a>, <a href="Component.html#setMixingCutoutShape(java.awt.Shape)">setMixingCutoutShape</a>, <a href="Component.html#setName(java.lang.String)">setName</a>, <a href="Component.html#setPreferredSize(java.awt.Dimension)">setPreferredSize</a>, <a href="Component.html#setSize(int,int)">setSize</a>, <a href="Component.html#setSize(java.awt.Dimension)">setSize</a>, <a href="Component.html#setVisible(boolean)">setVisible</a>, <a href="Component.html#show()">show</a>, <a href="Component.html#show(boolean)">show</a>, <a href="Component.html#size()">size</a>, <a href="Component.html#toString()">toString</a>, <a href="Component.html#transferFocus()">transferFocus</a>, <a href="Component.html#transferFocusBackward()">transferFocusBackward</a>, <a href="Component.html#transferFocusUpCycle()">transferFocusUpCycle</a>, <a href="Component.html#update(java.awt.Graphics)">update</a>, <a href="Component.html#validate()">validate</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods declared in class java.lang.<a href="../../../java.base/java/lang/Object.html" title="class in java.lang">Object</a></h3>
<code><a href="../../../java.base/java/lang/Object.html#clone()">clone</a>, <a href="../../../java.base/java/lang/Object.html#equals(java.lang.Object)">equals</a>, <a href="../../../java.base/java/lang/Object.html#finalize()">finalize</a>, <a href="../../../java.base/java/lang/Object.html#getClass()">getClass</a>, <a href="../../../java.base/java/lang/Object.html#hashCode()">hashCode</a>, <a href="../../../java.base/java/lang/Object.html#notify()">notify</a>, <a href="../../../java.base/java/lang/Object.html#notifyAll()">notifyAll</a>, <a href="../../../java.base/java/lang/Object.html#wait()">wait</a>, <a href="../../../java.base/java/lang/Object.html#wait(long)">wait</a>, <a href="../../../java.base/java/lang/Object.html#wait(long,int)">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="<init>()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Button</h4>
<pre>public Button()
throws <a href="HeadlessException.html" title="class in java.awt">HeadlessException</a></pre>
<div class="block">Constructs a button with an empty string for its label.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="HeadlessException.html" title="class in java.awt">HeadlessException</a></code> - if GraphicsEnvironment.isHeadless()
returns true</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="GraphicsEnvironment.html#isHeadless()"><code>GraphicsEnvironment.isHeadless()</code></a></dd>
</dl>
</li>
</ul>
<a id="<init>(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Button</h4>
<pre>public Button​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> label)
throws <a href="HeadlessException.html" title="class in java.awt">HeadlessException</a></pre>
<div class="block">Constructs a button with the specified label.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>label</code> - a string label for the button, or
<code>null</code> for no label</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="HeadlessException.html" title="class in java.awt">HeadlessException</a></code> - if GraphicsEnvironment.isHeadless()
returns true</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="GraphicsEnvironment.html#isHeadless()"><code>GraphicsEnvironment.isHeadless()</code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="addNotify()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addNotify</h4>
<pre class="methodSignature">public void addNotify()</pre>
<div class="block">Creates the peer of the button. The button's peer allows the
application to change the look of the button without changing
its functionality.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Component.html#addNotify()">addNotify</a></code> in class <code><a href="Component.html" title="class in java.awt">Component</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="Component.html#getToolkit()"><code>Component.getToolkit()</code></a></dd>
</dl>
</li>
</ul>
<a id="getLabel()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLabel</h4>
<pre class="methodSignature">public <a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> getLabel()</pre>
<div class="block">Gets the label of this button.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the button's label, or <code>null</code>
if the button has no label.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#setLabel(java.lang.String)"><code>setLabel(java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a id="setLabel(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setLabel</h4>
<pre class="methodSignature">public void setLabel​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> label)</pre>
<div class="block">Sets the button's label to be the specified string.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>label</code> - the new label, or <code>null</code>
if the button has no label.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#getLabel()"><code>getLabel()</code></a></dd>
</dl>
</li>
</ul>
<a id="setActionCommand(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setActionCommand</h4>
<pre class="methodSignature">public void setActionCommand​(<a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> command)</pre>
<div class="block">Sets the command name for the action event fired
by this button. By default this action command is
set to match the label of the button.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>command</code> - a string used to set the button's
action command.
If the string is <code>null</code> then the action command
is set to match the label of the button.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="event/ActionEvent.html" title="class in java.awt.event"><code>ActionEvent</code></a></dd>
</dl>
</li>
</ul>
<a id="getActionCommand()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getActionCommand</h4>
<pre class="methodSignature">public <a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> getActionCommand()</pre>
<div class="block">Returns the command name of the action event fired by this button.
If the command name is <code>null</code> (default) then this method
returns the label of the button.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the action command name (or label) for this button</dd>
</dl>
</li>
</ul>
<a id="addActionListener(java.awt.event.ActionListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addActionListener</h4>
<pre class="methodSignature">public void addActionListener​(<a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a> l)</pre>
<div class="block">Adds the specified action listener to receive action events from
this button. Action events occur when a user presses or releases
the mouse over this button.
If l is null, no exception is thrown and no action is performed.
<p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads">AWT Threading Issues</a> for details on AWT's threading model.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>l</code> - the action listener</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#removeActionListener(java.awt.event.ActionListener)"><code>removeActionListener(java.awt.event.ActionListener)</code></a>,
<a href="#getActionListeners()"><code>getActionListeners()</code></a>,
<a href="event/ActionListener.html" title="interface in java.awt.event"><code>ActionListener</code></a></dd>
</dl>
</li>
</ul>
<a id="removeActionListener(java.awt.event.ActionListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeActionListener</h4>
<pre class="methodSignature">public void removeActionListener​(<a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a> l)</pre>
<div class="block">Removes the specified action listener so that it no longer
receives action events from this button. Action events occur
when a user presses or releases the mouse over this button.
If l is null, no exception is thrown and no action is performed.
<p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads">AWT Threading Issues</a> for details on AWT's threading model.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>l</code> - the action listener</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#addActionListener(java.awt.event.ActionListener)"><code>addActionListener(java.awt.event.ActionListener)</code></a>,
<a href="#getActionListeners()"><code>getActionListeners()</code></a>,
<a href="event/ActionListener.html" title="interface in java.awt.event"><code>ActionListener</code></a></dd>
</dl>
</li>
</ul>
<a id="getActionListeners()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getActionListeners</h4>
<pre class="methodSignature">public <a href="event/ActionListener.html" title="interface in java.awt.event">ActionListener</a>[] getActionListeners()</pre>
<div class="block">Returns an array of all the action listeners
registered on this button.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>all of this button's <code>ActionListener</code>s
or an empty array if no action
listeners are currently registered</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.4</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#addActionListener(java.awt.event.ActionListener)"><code>addActionListener(java.awt.event.ActionListener)</code></a>,
<a href="#removeActionListener(java.awt.event.ActionListener)"><code>removeActionListener(java.awt.event.ActionListener)</code></a>,
<a href="event/ActionListener.html" title="interface in java.awt.event"><code>ActionListener</code></a></dd>
</dl>
</li>
</ul>
<a id="getListeners(java.lang.Class)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getListeners</h4>
<pre class="methodSignature">public <T extends <a href="../../../java.base/java/util/EventListener.html" title="interface in java.util">EventListener</a>> T[] getListeners​(<a href="../../../java.base/java/lang/Class.html" title="class in java.lang">Class</a><T> listenerType)</pre>
<div class="block">Returns an array of all the objects currently registered
as <code><em>Foo</em>Listener</code>s
upon this <code>Button</code>.
<code><em>Foo</em>Listener</code>s are registered using the
<code>add<em>Foo</em>Listener</code> method.
<p>
You can specify the <code>listenerType</code> argument
with a class literal, such as
<code><em>Foo</em>Listener.class</code>.
For example, you can query a
<code>Button b</code>
for its action listeners with the following code:
<pre>ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class));</pre>
If no such listeners exist, this method returns an empty array.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Component.html#getListeners(java.lang.Class)">getListeners</a></code> in class <code><a href="Component.html" title="class in java.awt">Component</a></code></dd>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of the listeners</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listenerType</code> - the type of listeners requested; this parameter
should specify an interface that descends from
<code>java.util.EventListener</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an array of all objects registered as
<code><em>Foo</em>Listener</code>s on this button,
or an empty array if no such
listeners have been added</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../java.base/java/lang/ClassCastException.html" title="class in java.lang">ClassCastException</a></code> - if <code>listenerType</code>
doesn't specify a class or interface that implements
<code>java.util.EventListener</code></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.3</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#getActionListeners()"><code>getActionListeners()</code></a></dd>
</dl>
</li>
</ul>
<a id="processEvent(java.awt.AWTEvent)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>processEvent</h4>
<pre class="methodSignature">protected void processEvent​(<a href="AWTEvent.html" title="class in java.awt">AWTEvent</a> e)</pre>
<div class="block">Processes events on this button. If an event is
an instance of <code>ActionEvent</code>, this method invokes
the <code>processActionEvent</code> method. Otherwise,
it invokes <code>processEvent</code> on the superclass.
<p>Note that if the event parameter is <code>null</code>
the behavior is unspecified and may result in an
exception.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Component.html#processEvent(java.awt.AWTEvent)">processEvent</a></code> in class <code><a href="Component.html" title="class in java.awt">Component</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>e</code> - the event</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="event/ActionEvent.html" title="class in java.awt.event"><code>ActionEvent</code></a>,
<a href="#processActionEvent(java.awt.event.ActionEvent)"><code>processActionEvent(java.awt.event.ActionEvent)</code></a></dd>
</dl>
</li>
</ul>
<a id="processActionEvent(java.awt.event.ActionEvent)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>processActionEvent</h4>
<pre class="methodSignature">protected void processActionEvent​(<a href="event/ActionEvent.html" title="class in java.awt.event">ActionEvent</a> e)</pre>
<div class="block">Processes action events occurring on this button
by dispatching them to any registered
<code>ActionListener</code> objects.
<p>
This method is not called unless action events are
enabled for this button. Action events are enabled
when one of the following occurs:
<ul>
<li>An <code>ActionListener</code> object is registered
via <code>addActionListener</code>.
<li>Action events are enabled via <code>enableEvents</code>.
</ul>
<p>Note that if the event parameter is <code>null</code>
the behavior is unspecified and may result in an
exception.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>e</code> - the action event</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="event/ActionListener.html" title="interface in java.awt.event"><code>ActionListener</code></a>,
<a href="#addActionListener(java.awt.event.ActionListener)"><code>addActionListener(java.awt.event.ActionListener)</code></a>,
<a href="Component.html#enableEvents(long)"><code>Component.enableEvents(long)</code></a></dd>
</dl>
</li>
</ul>
<a id="paramString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>paramString</h4>
<pre class="methodSignature">protected <a href="../../../java.base/java/lang/String.html" title="class in java.lang">String</a> paramString()</pre>
<div class="block">Returns a string representing the state of this <code>Button</code>.
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
<code>null</code>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Component.html#paramString()">paramString</a></code> in class <code><a href="Component.html" title="class in java.awt">Component</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the parameter string of this button</dd>
</dl>
</li>
</ul>
<a id="getAccessibleContext()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getAccessibleContext</h4>
<pre class="methodSignature"><a href="../beans/BeanProperty.html" title="annotation in java.beans">@BeanProperty</a>(<a href="../beans/BeanProperty.html#expert()">expert</a>=true,
<a href="../beans/BeanProperty.html#description()">description</a>="The AccessibleContext associated with this Button.")
public <a href="../../javax/accessibility/AccessibleContext.html" title="class in javax.accessibility">AccessibleContext</a> getAccessibleContext()</pre>
<div class="block">Gets the <code>AccessibleContext</code> associated with
this <code>Button</code>. For buttons, the
<code>AccessibleContext</code> takes the form of an
<code>AccessibleAWTButton</code>.
A new <code>AccessibleAWTButton</code> instance is
created if necessary.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/accessibility/Accessible.html#getAccessibleContext()">getAccessibleContext</a></code> in interface <code><a href="../../javax/accessibility/Accessible.html" title="interface in javax.accessibility">Accessible</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Component.html#getAccessibleContext()">getAccessibleContext</a></code> in class <code><a href="Component.html" title="class in java.awt">Component</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an <code>AccessibleAWTButton</code> that serves as the
<code>AccessibleContext</code> of this <code>Button</code></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.3</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Button.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 & JDK 12</strong> </div></div>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small><a href="https://bugreport.java.com/bugreport/">Report a bug or suggest an enhancement</a><br> For further API reference and developer documentation see the <a href="https://docs.oracle.com/pls/topic/lookup?ctx=javase12.0.2&id=homepage" target="_blank">Java SE Documentation</a>, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.<br> <a href="../../../../legal/copyright.html">Copyright</a> © 1993, 2019, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.<br>All rights reserved. Use is subject to <a href="https://www.oracle.com/technetwork/java/javase/terms/license/java12.0.2speclicense.html">license terms</a> and the <a href="https://www.oracle.com/technetwork/java/redist-137594.html">documentation redistribution policy</a>. <!-- Version 12.0.2+10 --></small></p>
</footer>
</body>
</html>