AI2 Component  (Version nb184)
CheckBox.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 2018 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 
18 
27 @DesignerComponent(version = YaVersion.CHECKBOX_COMPONENT_VERSION,
28  description = "Checkbox that raises an event when the user clicks on it. " +
29  "There are many properties affecting its appearance that can be set in " +
30  "the Designer or Blocks Editor.",
31  category = ComponentCategory.USERINTERFACE)
32 @SimpleObject
33 public final class CheckBox extends ToggleBase<android.widget.CheckBox> {
34 
40  public CheckBox(ComponentContainer container) {
41  super(container);
42  view = new android.widget.CheckBox(container.$context());
43  Checked(false);
44  initToggle();
45  }
46 
53  category = PropertyCategory.BEHAVIOR,
54  description = "True if the box is checked, false otherwise.")
55  public boolean Checked() {
56  return view.isChecked();
57  }
58 
66  defaultValue = "False")
68  public void Checked(boolean value) {
69  view.setChecked(value);
70  view.invalidate();
71  }
72 
73 }
com.google.appinventor.components.annotations.SimpleFunction
Definition: SimpleFunction.java:23
com.google.appinventor.components.runtime.CheckBox.CheckBox
CheckBox(ComponentContainer container)
Definition: CheckBox.java:40
com.google.appinventor.components.common.YaVersion
Definition: YaVersion.java:14
com.google.appinventor.components.annotations.DesignerProperty
Definition: DesignerProperty.java:25
com.google.appinventor.components
com.google.appinventor.components.runtime.CheckBox.Checked
void Checked(boolean value)
Definition: CheckBox.java:68
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN
static final String PROPERTY_TYPE_BOOLEAN
Definition: PropertyTypeConstants.java:35
com.google.appinventor.components.annotations.DesignerComponent
Definition: DesignerComponent.java:22
com.google.appinventor.components.annotations.PropertyCategory.BEHAVIOR
BEHAVIOR
Definition: PropertyCategory.java:15
com.google.appinventor.components.runtime.ToggleBase< android.widget.CheckBox >::initToggle
void initToggle()
Definition: ToggleBase.java:60
com.google.appinventor.components.runtime.CheckBox
Definition: CheckBox.java:33
com.google.appinventor.components.runtime.ToggleBase< android.widget.CheckBox >::view
T view
Definition: ToggleBase.java:32
com.google.appinventor.components.annotations.SimpleProperty
Definition: SimpleProperty.java:23
com.google.appinventor.components.annotations.PropertyCategory
Definition: PropertyCategory.java:13
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
com
com.google.appinventor.components.runtime.ComponentContainer.$context
Activity $context()
com.google.appinventor.components.runtime.ToggleBase
Definition: ToggleBase.java:29
com.google.appinventor.components.runtime.CheckBox.Checked
boolean Checked()
Definition: CheckBox.java:55
com.google.appinventor.components.common.PropertyTypeConstants
Definition: PropertyTypeConstants.java:14
com.google.appinventor.components.annotations
com.google.appinventor