Image Loading

There are a number of cases where a module developer may want access to images. The most obvious case is in the development of a user interface, or visualization module that uses images as part of their content.

For this purpose, a method of Module is provided to load an image from the module directory. It takes a string, this string is the path within the modules directory where the image can be found. Here is the method's definition:

  public Image getImage(String name);

This method is implemented in the base class from which all modules inherit. It will return the image found, if one exists, or null if there is no such image found.

However, a module can also provide a reference to an image that can be used by the D2K Toolkit to display its representation in the Toolkit's workspace. This method is rarely overridden, however, if there is a special representation you would like to associate with your module, this method is the way to do it. If possible, the image should extend the standard images provided for Compute, DataPrep, Input, Output, Vis and UserInput modules. In this way, the module will be easy for the users to identify.

This method is defined like so:

  public String getGuiComponent();

The default implementation of this method simply returns null, but it can return a String to override the default images used by the D2K Toolkit. The String returned defines a path relative to the modules directory.