AI2 Component
(Version nb184)
Button.java
Go to the documentation of this file.
1
// -*- mode: java; c-basic-offset: 2; -*-
2
// Copyright 2009-2011 Google, All Rights reserved
3
// Copyright 2011-2012 MIT, All rights reserved
4
// Released under the Apache License, Version 2.0
5
// http://www.apache.org/licenses/LICENSE-2.0
6
7
package
com.google.appinventor.components.runtime;
8
9
import
com
.
google
.
appinventor
.
components
.
annotations
.
DesignerComponent
;
10
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleEvent
;
11
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleObject
;
12
import
com
.
google
.
appinventor
.
components
.
common
.
ComponentCategory
;
13
import
com
.
google
.
appinventor
.
components
.
common
.
YaVersion
;
14
20
@DesignerComponent(version = YaVersion.BUTTON_COMPONENT_VERSION,
21
category = ComponentCategory.USERINTERFACE,
22
description =
"Button with the ability to detect clicks. Many aspects "
+
23
"of its appearance can be changed, as well as whether it is clickable "
+
24
"(<code>Enabled</code>), can be changed in the Designer or in the Blocks "
+
25
"Editor."
)
26
@SimpleObject
27
public
final
class
Button
extends
ButtonBase
{
28
34
public
Button
(
ComponentContainer
container
) {
35
super(
container
);
36
}
37
38
@Override
39
public
void
click
() {
40
// Call the users Click event handler. Note that we distinguish the click() abstract method
41
// implementation from the Click() event handler method.
42
Click
();
43
}
44
48
@
SimpleEvent
(description =
"User tapped and released the button."
)
49
public
void
Click
() {
50
EventDispatcher
.
dispatchEvent
(
this
,
"Click"
);
51
}
52
53
@Override
54
public
boolean
longClick
() {
55
// Call the users Click event handler. Note that we distinguish the longclick() abstract method
56
// implementation from the LongClick() event handler method.
57
return
LongClick
();
58
}
59
63
@
SimpleEvent
(description =
"User held the button down."
)
64
public
boolean
LongClick
() {
65
return
EventDispatcher
.
dispatchEvent
(
this
,
"LongClick"
);
66
}
67
}
com.google.appinventor.components.runtime.EventDispatcher
Definition:
EventDispatcher.java:22
com.google.appinventor.components.common.YaVersion
Definition:
YaVersion.java:14
com.google.appinventor.components.runtime.Button.Click
void Click()
Definition:
Button.java:49
com.google.appinventor.components
com.google.appinventor.components.runtime.Button.longClick
boolean longClick()
Definition:
Button.java:54
com.google.appinventor.components.annotations.DesignerComponent
Definition:
DesignerComponent.java:22
com.google.appinventor.components.annotations.SimpleEvent
Definition:
SimpleEvent.java:20
com.google.appinventor.components.runtime.Button.click
void click()
Definition:
Button.java:39
com.google.appinventor.components.runtime.Button.LongClick
boolean LongClick()
Definition:
Button.java:64
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition:
EventDispatcher.java:188
com.google.appinventor.components.runtime.Button.Button
Button(ComponentContainer container)
Definition:
Button.java:34
com.google.appinventor.components.runtime.Button
Definition:
Button.java:27
com.google.appinventor.components.runtime.ComponentContainer
Definition:
ComponentContainer.java:16
com.google.appinventor.components.common
Definition:
ComponentCategory.java:7
com.google.appinventor.components.common.ComponentCategory
Definition:
ComponentCategory.java:48
com.google.appinventor.components.annotations.SimpleObject
Definition:
SimpleObject.java:23
com.google.appinventor.components.runtime.AndroidViewComponent.container
final ComponentContainer container
Definition:
AndroidViewComponent.java:29
com.google
com.google.appinventor.components.runtime.ButtonBase
Definition:
ButtonBase.java:47
com
com.google.appinventor.components.annotations
com.google.appinventor
com
google
appinventor
components
runtime
Button.java
Generated by
1.8.16