Component Extensions

Components and UIs can have extensions which are attached to the component dynamically. Especially, many add-ons are extensions.

How a component is extended depends on the extension. Typically, they have an extend() method that takes the component to be extended as the parameter.

Java

  1. TextField tf = new TextField("Hello");
  2. layout.addComponent(tf);
  3. // Add a simple extension
  4. new CapsLockWarning().extend(tf);
  5. // Add an extension that requires some parameters
  6. CSValidator validator = new CSValidator();
  7. validator.setRegExp("[0-9]*");
  8. validator.setErrorMessage("Must be a number");
  9. validator.extend(tf);

Development of custom extensions is described in “Component and UI Extensions”.