Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Swing Script helper



The DefaultSwingScriptHelper class is a swing implementation of the ScriptHelper which has additional methods.

DefaultSwingScriptHelper API

The DefaultSwingScriptHelper class has the following additional methods:
If the user cancels the dialog without entering a value, the result will be null.


The DefaultSwingScriptHelper.getImports() return the set of additional imports to use to use these additional methods.

Examples

Setting one value

The following code shows a dialog window allowing to set an int:

   public int execute() {
      Integer value = helper.askForIntProperty("Value", 0, 100, 1);
      if (value != null) {
        return value;
      } else {
        return 0;
      }
   }

Setting more than one value

The following code shows a dialog window allowing to set an int and a boolean:

   public int execute() {
      PropertySetter setter = helper.getPropertySetter("Set Values");
      setter.addProperty("int", "Int Value", PropertyTypes.TYPE_INT, 0, 100, 1);
      setter.addProperty("bool", "Boolean Value", PropertyTypes.TYPE_BOOLEAN);
      setter.askForProperties();
      int i = setter.getIntProperty("int", 0);
      boolean b = setter.getBooleanroperty("bool");
      if (b) {
        return i;
      } else {
        return 0;
      }
   }

See also


Categories: api | swing

Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence