01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package javax.microedition.lcdui;
28:
29: /**
30: * This interface is used by applications which need to receive
31: * high-level events from the implementation. An application will
32: * provide an implementation of a <code>CommandListener</code>
33: * (typically by using
34: * a nested class or an inner class) and will then provide the
35: * instance to the <CODE>addCommand</CODE> method on a
36: * <code>Displayable</code> in
37: * order to receive high-level events on that screen.
38: *
39: * <p>The specification does not require the platform to create several
40: * threads for the event delivery.
41: * Thus, if a <code>CommandListener</code> method does not return
42: * or the return is
43: * not delayed, the system may be blocked. So, there is the following note to
44: * application developers:</p>
45: * <UL>
46: * <LI><em>the <code>CommandListener</code> method should return
47: * immediately</em>.</LI>
48: * </UL>
49: *
50: * @see javax.microedition.lcdui.Displayable#setCommandListener
51: * @since MIDP 1.0
52: */
53: public interface CommandListener {
54:
55: /**
56: * Indicates that a command event has occurred on
57: * <code>Displayable d</code>.
58: *
59: * @param c a <code>Command</code> object identifying the
60: * command. This is either one of the
61: * applications have been added to <code>Displayable</code> with
62: * {@link Displayable#addCommand(Command)
63: * addCommand(Command)} or is the implicit
64: * {@link List#SELECT_COMMAND SELECT_COMMAND} of
65: * <code>List</code>.
66: * @param d the <code>Displayable</code> on which this event
67: * has occurred
68: */
69: void commandAction(Command c, Displayable d);
70: }
|