Search code examples
javajungjung2

Unable to call setVertexFillPaintTransformer - method is not applicable for the arguments


I'm unable to run any of the Jung examples that set or change the Vertex (or other Transformers). I receive the following error:

The method setVertexFillPaintTransformer(Function) in the type RenderContext is not applicable for the arguments (Transformer<String,Paint>)

The sample code:

        vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);

where vertexPaint is

Transformer<String,Paint> vertexPaint = new Transformer<String,Paint>() {
           public Paint transform(String b) {
              return Color.orange;
           }
        };

Solution

  • It looks like you're using version 2.1.* of the JUNG libraries (which uses the Guava types in place of the old common-collections-generics types such as Transformer: https://github.com/jrtom/jung/releases), but using an older version of the sample code.

    If you use the version of the sample code that comes with 2.1.1, you should be fine.