Skip to content

Commit 36fec0e

Browse files
committed
Exemplify setting the automatic layout strategy.
1 parent 85b8ad7 commit 36fec0e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • src/main/java/com/brunomnsilva/smartgraph

src/main/java/com/brunomnsilva/smartgraph/Main.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ public void start(Stage ignored) {
5151
//Graph<String, String> g = build_flower_graph();
5252
System.out.println(g);
5353

54-
SmartPlacementStrategy strategy = new SmartCircularSortedPlacementStrategy();
55-
//SmartPlacementStrategy strategy = new SmartRandomPlacementStrategy();
56-
SmartGraphPanel<String, String> graphView = new SmartGraphPanel<>(g, strategy);
54+
SmartPlacementStrategy initialPlacement = new SmartCircularSortedPlacementStrategy();
55+
//SmartPlacementStrategy initialPlacement = new SmartRandomPlacementStrategy();
56+
57+
ForceDirectedLayoutStrategy<String> automaticPlacementStrategy = new ForceDirectedSpringGravityLayoutStrategy<>();
58+
//ForceDirectedLayoutStrategy<String> automaticPlacementStrategy = new ForceDirectedSpringSystemLayoutStrategy<>();
59+
60+
SmartGraphPanel<String, String> graphView = new SmartGraphPanel<>(g, initialPlacement, automaticPlacementStrategy);
5761

5862
/*
5963
After creating, you can change the styling of some element.

0 commit comments

Comments
 (0)