JUNG change color of Nodes from green until white

38 Views Asked by At

I'm trying to change the color of the Cluster Nodes from dark green to light green or white. But I don't have an approach for that, or I'm searching for an approach.

public WebSearchInterface() { setLayout(new BorderLayout());
    graph = GraphHandler.createForestTestempty();
    vv = VisualizationViewer.builder(graph)
                        .layoutAlgorithm(new StaticLayoutAlgorithm<>())
                        .layoutSize(layoutSize)
                        .viewSize(viewSize)
                        .graphMouse(graphMouse)
                        .build();

    vv.addPreRenderPaintable(
                new LayoutPaintable.LayoutBounds(
                        vv.getVisualizationModel(), vv.getRenderContext().getMultiLayerTransformer()));     
        
        
    Box controls = Box.createHorizontalBox();
    controls.add(
                GraphControlHelpers.getCenteredContainer(
                        "Layout Controls", GraphLayoutSelector.builder(vv).initialSelection(1).build()));
        //controls.add(GraphControlHelpers.getCenteredContainer("Search",GraphLayoutSelector.InputtextF),BorderLayout.CENTER);
        controls.add(GraphControlHelpers.getCenteredContainer("Zoom",GraphControlHelpers.getZoom(vv)));
        controls.add(GraphControlHelpers.getCenteredContainer("Node properties",GraphLayoutSelector.GraphPropList));

        add(controls, BorderLayout.SOUTH);
        panel = new VisualizationScrollPane(vv);
        add(panel);
}

Is my Cluster

enter image description here

I know I can use the following function. I don't know how to degree or change the color from dark green until very light green or white. Maybe some one has an idea. I also created a List of this green color's. But I'm searching for an approach to change the colors from dark green until very light green or white.

public static Color[] clusterColor =  {new Color(0, 102, 0), new Color(0, 153, 0), new Color(0, 204, 0), new Color(0, 255, 51), new Color(102, 255, 102)};   

       vv.getRenderContext().setVertexFillPaintFunction(v->{ // set vertex color
 
          else if(v.equals(Center)&&(!Center.isEmpty()))
          {
            return Color.yellow;
          }
          else if((!v.equals(Center)) // first cluster  v is an string 
          {
              cnt_Vertex = cnt_Vertex +1;
              System.out.println(cnt_Vertex);
              System.out.println(v);
                  return clusterColor[2];
          }
          return Color.blue;
        });
0

There are 0 best solutions below