Looking for How to create extensions blocks

If you write a function, then it will be a purple block (method).

Usage:

@SimpleFunction(description = "Block description")
     public void BlockName(parameters) {
     /* Your code here. */
     }

Example:

@SimpleFunction(description = "Join two text.")
     public String Join(String t1, String t2) {
     return t1 + t2;
     }

And this is for the property, green block.

Get:

@SimpleProperty(category = PropertyCategory.BEHAVIOR,
      description = "Block description.")
  public String Source() {
    return fileName;
  }

Set:

@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING,
      defaultValue = "")
@SimpleProperty
  public void Source(String fileName) {
    this.fileName = fileName;
  }

This is only example, you need to do research to learn more about AI2 Extensions.

31 Likes