0

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;
           }
        };
anarche
  • 536
  • 4
  • 19

1 Answers1

1

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.

Joshua O'Madadhain
  • 2,704
  • 1
  • 14
  • 18
  • I've found the samples and pulled down the latest git, but I'm unable to compile them - the most basic issue is that it seems to be getting confused - a typical error is "The constructor VisualizationViewer(Network, LayoutAlgorithm, Dimension) is undefined" - it looks like the code isn't using the right Jung version, even though I'm bringing in only Jung 2.1.1 libraries – anarche Mar 28 '18 at 04:10
  • I should mention that I'm adding the guava maven dependency, else it complains - com.google.guava guava 24.1-jre – anarche Mar 28 '18 at 04:13
  • 1
    See https://stackoverflow.com/questions/49535831/weird-import-issues-jung2 for an answer to the above concern. – Joshua O'Madadhain Mar 28 '18 at 15:19