OSDN Git Service

902b202f4f328b776f62507d884163fb0fdd746e
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / docs / apidocs / lejos / nxt / Button.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.5.0_09) on Mon May 05 21:42:41 BST 2008 -->
6 <TITLE>
7 Button (leJOS NXT API documentation)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="lejos.nxt.Button class">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17     parent.document.title="Button (leJOS NXT API documentation)";
18 }
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
22
23 </HEAD>
24
25 <BODY BGCOLOR="white" onload="windowTitle();">
26
27
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME="navbar_top"><!-- --></A>
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32 <TR>
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34 <A NAME="navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36   <TR ALIGN="center" VALIGN="top">
37   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44   </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
51
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../lejos/nxt/Battery.html" title="class in lejos.nxt"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<A HREF="../../lejos/nxt/ButtonListener.html" title="interface in lejos.nxt"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57   <A HREF="../../index.html?lejos/nxt/Button.html" target="_top"><B>FRAMES</B></A>  &nbsp;
58 &nbsp;<A HREF="Button.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60   <!--
61   if(window==top) {
62     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
63   }
64   //-->
65 </SCRIPT>
66 <NOSCRIPT>
67   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
69
70
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
82
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 lejos.nxt</FONT>
88 <BR>
89 Class Button</H2>
90 <PRE>
91 <A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
92   <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>lejos.nxt.Button</B>
93 </PRE>
94 <DL>
95 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../lejos/nxt/ListenerCaller.html" title="interface in lejos.nxt">ListenerCaller</A></DD>
96 </DL>
97 <HR>
98 <DL>
99 <DT><PRE>public class <B>Button</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A><DT>implements <A HREF="../../lejos/nxt/ListenerCaller.html" title="interface in lejos.nxt">ListenerCaller</A></DL>
100 </PRE>
101
102 <P>
103 Abstraction for an NXT button.
104  Example:<p>
105  <code><pre>
106     Button.ENTER.waitForPressAndRelease();
107     Sound.playTone (1000, 1);
108  </pre></code>
109 <P>
110
111 <P>
112 <HR>
113
114 <P>
115 <!-- =========== FIELD SUMMARY =========== -->
116
117 <A NAME="field_summary"><!-- --></A>
118 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
119 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
120 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
121 <B>Field Summary</B></FONT></TH>
122 </TR>
123 <TR BGCOLOR="white" CLASS="TableRowColor">
124 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
125 <CODE>static&nbsp;<A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A>[]</CODE></FONT></TD>
126 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#BUTTONS">BUTTONS</A></B></CODE>
127
128 <BR>
129 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array containing ENTER, LEFT, RIGHT, ESCAPE, in that order.</TD>
130 </TR>
131 <TR BGCOLOR="white" CLASS="TableRowColor">
132 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
133 <CODE>static&nbsp;<A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A></CODE></FONT></TD>
134 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#ENTER">ENTER</A></B></CODE>
135
136 <BR>
137 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Enter button.</TD>
138 </TR>
139 <TR BGCOLOR="white" CLASS="TableRowColor">
140 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
141 <CODE>static&nbsp;<A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A></CODE></FONT></TD>
142 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#ESCAPE">ESCAPE</A></B></CODE>
143
144 <BR>
145 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Escape button.</TD>
146 </TR>
147 <TR BGCOLOR="white" CLASS="TableRowColor">
148 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
149 <CODE>static&nbsp;<A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A></CODE></FONT></TD>
150 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#LEFT">LEFT</A></B></CODE>
151
152 <BR>
153 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Left button.</TD>
154 </TR>
155 <TR BGCOLOR="white" CLASS="TableRowColor">
156 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
157 <CODE>static&nbsp;<A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A></CODE></FONT></TD>
158 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#RIGHT">RIGHT</A></B></CODE>
159
160 <BR>
161 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Right button.</TD>
162 </TR>
163 <TR BGCOLOR="white" CLASS="TableRowColor">
164 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
165 <CODE>static&nbsp;<A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
166 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#VOL_SETTING">VOL_SETTING</A></B></CODE>
167
168 <BR>
169 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
170 </TR>
171 </TABLE>
172 &nbsp;
173 <!-- ========== METHOD SUMMARY =========== -->
174
175 <A NAME="method_summary"><!-- --></A>
176 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
177 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
178 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
179 <B>Method Summary</B></FONT></TH>
180 </TR>
181 <TR BGCOLOR="white" CLASS="TableRowColor">
182 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
183 <CODE>&nbsp;void</CODE></FONT></TD>
184 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#addButtonListener(lejos.nxt.ButtonListener)">addButtonListener</A></B>(<A HREF="../../lejos/nxt/ButtonListener.html" title="interface in lejos.nxt">ButtonListener</A>&nbsp;aListener)</CODE>
185
186 <BR>
187 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a listener of button events.</TD>
188 </TR>
189 <TR BGCOLOR="white" CLASS="TableRowColor">
190 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
191 <CODE>&nbsp;void</CODE></FONT></TD>
192 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#callListeners()">callListeners</A></B>()</CODE>
193
194 <BR>
195 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call Button Listeners.</TD>
196 </TR>
197 <TR BGCOLOR="white" CLASS="TableRowColor">
198 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
199 <CODE>&nbsp;int</CODE></FONT></TD>
200 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#getId()">getId</A></B>()</CODE>
201
202 <BR>
203 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the ID of the button.</TD>
204 </TR>
205 <TR BGCOLOR="white" CLASS="TableRowColor">
206 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
207 <CODE>static&nbsp;int</CODE></FONT></TD>
208 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#getKeyClickLength()">getKeyClickLength</A></B>()</CODE>
209
210 <BR>
211 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the current key click length.</TD>
212 </TR>
213 <TR BGCOLOR="white" CLASS="TableRowColor">
214 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
215 <CODE>static&nbsp;int</CODE></FONT></TD>
216 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#getKeyClickTone(int)">getKeyClickTone</A></B>(int&nbsp;key)</CODE>
217
218 <BR>
219 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the click freq for a particular key.</TD>
220 </TR>
221 <TR BGCOLOR="white" CLASS="TableRowColor">
222 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
223 <CODE>static&nbsp;int</CODE></FONT></TD>
224 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#getKeyClickVolume()">getKeyClickVolume</A></B>()</CODE>
225
226 <BR>
227 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the current key click volume.</TD>
228 </TR>
229 <TR BGCOLOR="white" CLASS="TableRowColor">
230 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
231 <CODE>&nbsp;boolean</CODE></FONT></TD>
232 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#isPressed()">isPressed</A></B>()</CODE>
233
234 <BR>
235 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check if the button is pressed.</TD>
236 </TR>
237 <TR BGCOLOR="white" CLASS="TableRowColor">
238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
239 <CODE>static&nbsp;void</CODE></FONT></TD>
240 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#loadSettings()">loadSettings</A></B>()</CODE>
241
242 <BR>
243 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Load the current system settings associated with this class.</TD>
244 </TR>
245 <TR BGCOLOR="white" CLASS="TableRowColor">
246 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
247 <CODE>static&nbsp;int</CODE></FONT></TD>
248 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#readButtons()">readButtons</A></B>()</CODE>
249
250 <BR>
251 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>Low-level API</i> that reads status of buttons.</TD>
252 </TR>
253 <TR BGCOLOR="white" CLASS="TableRowColor">
254 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
255 <CODE>static&nbsp;void</CODE></FONT></TD>
256 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#setKeyClickLength(int)">setKeyClickLength</A></B>(int&nbsp;len)</CODE>
257
258 <BR>
259 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the len used for key clicks</TD>
260 </TR>
261 <TR BGCOLOR="white" CLASS="TableRowColor">
262 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
263 <CODE>static&nbsp;void</CODE></FONT></TD>
264 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#setKeyClickTone(int, int)">setKeyClickTone</A></B>(int&nbsp;key,
265                 int&nbsp;freq)</CODE>
266
267 <BR>
268 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the frequency used for a particular key.</TD>
269 </TR>
270 <TR BGCOLOR="white" CLASS="TableRowColor">
271 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
272 <CODE>static&nbsp;void</CODE></FONT></TD>
273 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#setKeyClickVolume(int)">setKeyClickVolume</A></B>(int&nbsp;vol)</CODE>
274
275 <BR>
276 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the volume used for key clicks</TD>
277 </TR>
278 <TR BGCOLOR="white" CLASS="TableRowColor">
279 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
280 <CODE>static&nbsp;int</CODE></FONT></TD>
281 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#waitForPress()">waitForPress</A></B>()</CODE>
282
283 <BR>
284 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wait for some button to be pressed</TD>
285 </TR>
286 <TR BGCOLOR="white" CLASS="TableRowColor">
287 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
288 <CODE>&nbsp;void</CODE></FONT></TD>
289 <TD><CODE><B><A HREF="../../lejos/nxt/Button.html#waitForPressAndRelease()">waitForPressAndRelease</A></B>()</CODE>
290
291 <BR>
292 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait until the button is released.</TD>
293 </TR>
294 </TABLE>
295 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
296 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
297 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
298 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
299 </TR>
300 <TR BGCOLOR="white" CLASS="TableRowColor">
301 <TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A></CODE></TD>
302 </TR>
303 </TABLE>
304 &nbsp;
305 <P>
306
307 <!-- ============ FIELD DETAIL =========== -->
308
309 <A NAME="field_detail"><!-- --></A>
310 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
311 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
312 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
313 <B>Field Detail</B></FONT></TH>
314 </TR>
315 </TABLE>
316
317 <A NAME="VOL_SETTING"><!-- --></A><H3>
318 VOL_SETTING</H3>
319 <PRE>
320 public static final <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>VOL_SETTING</B></PRE>
321 <DL>
322 <DL>
323 <DT><B>See Also:</B><DD><A HREF="../../constant-values.html#lejos.nxt.Button.VOL_SETTING">Constant Field Values</A></DL>
324 </DL>
325 <HR>
326
327 <A NAME="ENTER"><!-- --></A><H3>
328 ENTER</H3>
329 <PRE>
330 public static final <A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A> <B>ENTER</B></PRE>
331 <DL>
332 <DD>The Enter button.
333 <P>
334 <DL>
335 </DL>
336 </DL>
337 <HR>
338
339 <A NAME="LEFT"><!-- --></A><H3>
340 LEFT</H3>
341 <PRE>
342 public static final <A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A> <B>LEFT</B></PRE>
343 <DL>
344 <DD>The Left button.
345 <P>
346 <DL>
347 </DL>
348 </DL>
349 <HR>
350
351 <A NAME="RIGHT"><!-- --></A><H3>
352 RIGHT</H3>
353 <PRE>
354 public static final <A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A> <B>RIGHT</B></PRE>
355 <DL>
356 <DD>The Right button.
357 <P>
358 <DL>
359 </DL>
360 </DL>
361 <HR>
362
363 <A NAME="ESCAPE"><!-- --></A><H3>
364 ESCAPE</H3>
365 <PRE>
366 public static final <A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A> <B>ESCAPE</B></PRE>
367 <DL>
368 <DD>The Escape button.
369 <P>
370 <DL>
371 </DL>
372 </DL>
373 <HR>
374
375 <A NAME="BUTTONS"><!-- --></A><H3>
376 BUTTONS</H3>
377 <PRE>
378 public static final <A HREF="../../lejos/nxt/Button.html" title="class in lejos.nxt">Button</A>[] <B>BUTTONS</B></PRE>
379 <DL>
380 <DD>Array containing ENTER, LEFT, RIGHT, ESCAPE, in that order.
381 <P>
382 <DL>
383 </DL>
384 </DL>
385
386 <!-- ============ METHOD DETAIL ========== -->
387
388 <A NAME="method_detail"><!-- --></A>
389 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
390 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
391 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
392 <B>Method Detail</B></FONT></TH>
393 </TR>
394 </TABLE>
395
396 <A NAME="getId()"><!-- --></A><H3>
397 getId</H3>
398 <PRE>
399 public final int <B>getId</B>()</PRE>
400 <DL>
401 <DD>Return the ID of the button. One of 1, 2, 4 or 8.
402 <P>
403 <DD><DL>
404 </DL>
405 </DD>
406 <DD><DL>
407 </DL>
408 </DD>
409 </DL>
410 <HR>
411
412 <A NAME="isPressed()"><!-- --></A><H3>
413 isPressed</H3>
414 <PRE>
415 public final boolean <B>isPressed</B>()</PRE>
416 <DL>
417 <DD>Check if the button is pressed.
418 <P>
419 <DD><DL>
420 </DL>
421 </DD>
422 <DD><DL>
423
424 <DT><B>Returns:</B><DD><code>true</code> if button is pressed, <code>false</code> otherwise.</DL>
425 </DD>
426 </DL>
427 <HR>
428
429 <A NAME="waitForPressAndRelease()"><!-- --></A><H3>
430 waitForPressAndRelease</H3>
431 <PRE>
432 public final void <B>waitForPressAndRelease</B>()
433                                   throws <A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A></PRE>
434 <DL>
435 <DD>Wait until the button is released.
436 <P>
437 <DD><DL>
438 </DL>
439 </DD>
440 <DD><DL>
441
442 <DT><B>Throws:</B>
443 <DD><CODE><A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A></CODE></DL>
444 </DD>
445 </DL>
446 <HR>
447
448 <A NAME="waitForPress()"><!-- --></A><H3>
449 waitForPress</H3>
450 <PRE>
451 public static int <B>waitForPress</B>()</PRE>
452 <DL>
453 <DD>wait for some button to be pressed
454 <P>
455 <DD><DL>
456 </DL>
457 </DD>
458 <DD><DL>
459
460 <DT><B>Returns:</B><DD>the ID of that button, the same as readButtons();</DL>
461 </DD>
462 </DL>
463 <HR>
464
465 <A NAME="addButtonListener(lejos.nxt.ButtonListener)"><!-- --></A><H3>
466 addButtonListener</H3>
467 <PRE>
468 public void <B>addButtonListener</B>(<A HREF="../../lejos/nxt/ButtonListener.html" title="interface in lejos.nxt">ButtonListener</A>&nbsp;aListener)</PRE>
469 <DL>
470 <DD>Adds a listener of button events. Each button can serve at most
471  4 listeners.
472 <P>
473 <DD><DL>
474 </DL>
475 </DD>
476 <DD><DL>
477 </DL>
478 </DD>
479 </DL>
480 <HR>
481
482 <A NAME="readButtons()"><!-- --></A><H3>
483 readButtons</H3>
484 <PRE>
485 public static int <B>readButtons</B>()</PRE>
486 <DL>
487 <DD><i>Low-level API</i> that reads status of buttons.
488 <P>
489 <DD><DL>
490 </DL>
491 </DD>
492 <DD><DL>
493
494 <DT><B>Returns:</B><DD>An integer with possibly some bits set: 0x01 (ENTER button pressed)
495  0x02 (LEFT button pressed), 0x04 (RIGHT button pressed), 0x08 (ESCAPE button pressed).
496  If all buttons are released, this method returns 0.</DL>
497 </DD>
498 </DL>
499 <HR>
500
501 <A NAME="callListeners()"><!-- --></A><H3>
502 callListeners</H3>
503 <PRE>
504 public void <B>callListeners</B>()</PRE>
505 <DL>
506 <DD>Call Button Listeners. Used by ListenerThread.
507 <P>
508 <DD><DL>
509 <DT><B>Specified by:</B><DD><CODE><A HREF="../../lejos/nxt/ListenerCaller.html#callListeners()">callListeners</A></CODE> in interface <CODE><A HREF="../../lejos/nxt/ListenerCaller.html" title="interface in lejos.nxt">ListenerCaller</A></CODE></DL>
510 </DD>
511 <DD><DL>
512 </DL>
513 </DD>
514 </DL>
515 <HR>
516
517 <A NAME="setKeyClickVolume(int)"><!-- --></A><H3>
518 setKeyClickVolume</H3>
519 <PRE>
520 public static void <B>setKeyClickVolume</B>(int&nbsp;vol)</PRE>
521 <DL>
522 <DD>Set the volume used for key clicks
523 <P>
524 <DD><DL>
525 </DL>
526 </DD>
527 <DD><DL>
528 <DT><B>Parameters:</B><DD><CODE>vol</CODE> - </DL>
529 </DD>
530 </DL>
531 <HR>
532
533 <A NAME="getKeyClickVolume()"><!-- --></A><H3>
534 getKeyClickVolume</H3>
535 <PRE>
536 public static int <B>getKeyClickVolume</B>()</PRE>
537 <DL>
538 <DD>Return the current key click volume.
539 <P>
540 <DD><DL>
541 </DL>
542 </DD>
543 <DD><DL>
544
545 <DT><B>Returns:</B><DD>current click volume</DL>
546 </DD>
547 </DL>
548 <HR>
549
550 <A NAME="setKeyClickLength(int)"><!-- --></A><H3>
551 setKeyClickLength</H3>
552 <PRE>
553 public static void <B>setKeyClickLength</B>(int&nbsp;len)</PRE>
554 <DL>
555 <DD>Set the len used for key clicks
556 <P>
557 <DD><DL>
558 </DL>
559 </DD>
560 <DD><DL>
561 <DT><B>Parameters:</B><DD><CODE>len</CODE> - the click duration</DL>
562 </DD>
563 </DL>
564 <HR>
565
566 <A NAME="getKeyClickLength()"><!-- --></A><H3>
567 getKeyClickLength</H3>
568 <PRE>
569 public static int <B>getKeyClickLength</B>()</PRE>
570 <DL>
571 <DD>Return the current key click length.
572 <P>
573 <DD><DL>
574 </DL>
575 </DD>
576 <DD><DL>
577
578 <DT><B>Returns:</B><DD>key click duration</DL>
579 </DD>
580 </DL>
581 <HR>
582
583 <A NAME="setKeyClickTone(int, int)"><!-- --></A><H3>
584 setKeyClickTone</H3>
585 <PRE>
586 public static void <B>setKeyClickTone</B>(int&nbsp;key,
587                                    int&nbsp;freq)</PRE>
588 <DL>
589 <DD>Set the frequency used for a particular key. Setting this to 0 disables
590  the click. Note that key may also be a corded set of keys.
591 <P>
592 <DD><DL>
593 </DL>
594 </DD>
595 <DD><DL>
596 <DT><B>Parameters:</B><DD><CODE>key</CODE> - the NXT key<DD><CODE>freq</CODE> - the frequency</DL>
597 </DD>
598 </DL>
599 <HR>
600
601 <A NAME="getKeyClickTone(int)"><!-- --></A><H3>
602 getKeyClickTone</H3>
603 <PRE>
604 public static int <B>getKeyClickTone</B>(int&nbsp;key)</PRE>
605 <DL>
606 <DD>Return the click freq for a particular key.
607 <P>
608 <DD><DL>
609 </DL>
610 </DD>
611 <DD><DL>
612
613 <DT><B>Returns:</B><DD>key click duration</DL>
614 </DD>
615 </DL>
616 <HR>
617
618 <A NAME="loadSettings()"><!-- --></A><H3>
619 loadSettings</H3>
620 <PRE>
621 public static void <B>loadSettings</B>()</PRE>
622 <DL>
623 <DD>Load the current system settings associated with this class. Called
624  automatically to initialize the class. May be called if it is required
625  to reload any settings.
626 <P>
627 <DD><DL>
628 </DL>
629 </DD>
630 <DD><DL>
631 </DL>
632 </DD>
633 </DL>
634 <!-- ========= END OF CLASS DATA ========= -->
635 <HR>
636
637
638 <!-- ======= START OF BOTTOM NAVBAR ====== -->
639 <A NAME="navbar_bottom"><!-- --></A>
640 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
641 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
642 <TR>
643 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
644 <A NAME="navbar_bottom_firstrow"><!-- --></A>
645 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
646   <TR ALIGN="center" VALIGN="top">
647   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
648   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
649   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
650   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
651   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
652   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
653   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
654   </TR>
655 </TABLE>
656 </TD>
657 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
658 </EM>
659 </TD>
660 </TR>
661
662 <TR>
663 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
664 &nbsp;<A HREF="../../lejos/nxt/Battery.html" title="class in lejos.nxt"><B>PREV CLASS</B></A>&nbsp;
665 &nbsp;<A HREF="../../lejos/nxt/ButtonListener.html" title="interface in lejos.nxt"><B>NEXT CLASS</B></A></FONT></TD>
666 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
667   <A HREF="../../index.html?lejos/nxt/Button.html" target="_top"><B>FRAMES</B></A>  &nbsp;
668 &nbsp;<A HREF="Button.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
669 &nbsp;<SCRIPT type="text/javascript">
670   <!--
671   if(window==top) {
672     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
673   }
674   //-->
675 </SCRIPT>
676 <NOSCRIPT>
677   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
678 </NOSCRIPT>
679
680
681 </FONT></TD>
682 </TR>
683 <TR>
684 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
685   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
686 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
687 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
688 </TR>
689 </TABLE>
690 <A NAME="skip-navbar_bottom"></A>
691 <!-- ======== END OF BOTTOM NAVBAR ======= -->
692
693 <HR>
694
695 </BODY>
696 </HTML>