|
@@ -45,7 +45,7 @@ public class MainView {
|
|
* The 'frame' of the main window.
|
|
* The 'frame' of the main window.
|
|
* The reason why there can only be one instance of this class.
|
|
* The reason why there can only be one instance of this class.
|
|
*/
|
|
*/
|
|
- public static JFrame frame;
|
|
|
|
|
|
+ private JFrame frame;
|
|
private AnimationController controller;
|
|
private AnimationController controller;
|
|
private JButton stepForward;
|
|
private JButton stepForward;
|
|
private JButton stepForwardInto;
|
|
private JButton stepForwardInto;
|
|
@@ -137,7 +137,8 @@ public class MainView {
|
|
this.graph = graph;
|
|
this.graph = graph;
|
|
controller = new AnimationController();
|
|
controller = new AnimationController();
|
|
controller.setTimeBetween( 50 );
|
|
controller.setTimeBetween( 50 );
|
|
- BKNodePlacement algorithm = new BKNodePlacement( controller, graph );
|
|
|
|
|
|
+ frame = new JFrame();
|
|
|
|
+ BKNodePlacement algorithm = new BKNodePlacement( controller, graph, frame );
|
|
|
|
|
|
// Create Menu GUI
|
|
// Create Menu GUI
|
|
stepForward = new NiceButton( "stepForward" );
|
|
stepForward = new NiceButton( "stepForward" );
|
|
@@ -307,7 +308,6 @@ public class MainView {
|
|
JScrollPane treeView = new JScrollPane( pseudoTree );
|
|
JScrollPane treeView = new JScrollPane( pseudoTree );
|
|
treeView.setBounds( 10, 110, 380, 380 );
|
|
treeView.setBounds( 10, 110, 380, 380 );
|
|
|
|
|
|
- frame = new JFrame(); // this may write to a static field because there should be only one instance of this class.
|
|
|
|
frame.setSize( Math.min( (int)graph.getWidth( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 1700 ), Math.min( (int)graph.getHeight( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 900 ) );
|
|
frame.setSize( Math.min( (int)graph.getWidth( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 1700 ), Math.min( (int)graph.getHeight( LayoutType.TOP_BOTTOM_LEFT ) * 2 + 200, 900 ) );
|
|
frame.setLocation( 100, 100 );
|
|
frame.setLocation( 100, 100 );
|
|
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
|
|
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
|
|
@@ -408,8 +408,10 @@ public class MainView {
|
|
}
|
|
}
|
|
combined.setSize( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
combined.setSize( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
combined.setLocation( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
combined.setLocation( layne.getWidth() / 3, layne.getHeight() / 3 );
|
|
- frame.validate();
|
|
|
|
- frame.repaint();
|
|
|
|
|
|
+
|
|
|
|
+ layne.remove( pl );
|
|
|
|
+ layne.add( pl, 1 );
|
|
|
|
+ frame.repaint();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
algorithm.start();
|
|
algorithm.start();
|