|
@@ -1,14 +1,22 @@
|
|
|
package view;
|
|
|
|
|
|
+import java.awt.BorderLayout;
|
|
|
+import java.awt.Dimension;
|
|
|
import java.awt.GridLayout;
|
|
|
+import java.awt.Image;
|
|
|
import java.awt.event.ComponentAdapter;
|
|
|
import java.awt.event.ComponentEvent;
|
|
|
import java.awt.event.KeyEvent;
|
|
|
import java.awt.event.KeyListener;
|
|
|
+import java.net.URL;
|
|
|
|
|
|
+import javax.swing.ImageIcon;
|
|
|
+import javax.swing.JButton;
|
|
|
import javax.swing.JFrame;
|
|
|
+import javax.swing.JLabel;
|
|
|
import javax.swing.JLayeredPane;
|
|
|
import javax.swing.JPanel;
|
|
|
+import javax.swing.JTextField;
|
|
|
|
|
|
import animation.Action;
|
|
|
import animation.AnimationController;
|
|
@@ -31,7 +39,20 @@ public class MainView {
|
|
|
* The reason why there can only be one instance of this class.
|
|
|
*/
|
|
|
public static JFrame frame;
|
|
|
- AnimationController controller;
|
|
|
+ private AnimationController controller;
|
|
|
+ private JButton stepForward;
|
|
|
+ private JButton stepForwardInto;
|
|
|
+ private JButton stepForwardOut;
|
|
|
+ private JButton stepBackward;
|
|
|
+ private JButton stepBackwardInto;
|
|
|
+ private JButton stepBackwardOut;
|
|
|
+ private JButton runForward;
|
|
|
+ private JButton runBackward;
|
|
|
+ private JButton pause;
|
|
|
+ private JButton debug;
|
|
|
+ private JButton generateRandom;
|
|
|
+ private JLabel delayText;
|
|
|
+ private JTextField delay;
|
|
|
|
|
|
private String strToLen( String s, int l )
|
|
|
{
|
|
@@ -50,8 +71,33 @@ public class MainView {
|
|
|
*/
|
|
|
public MainView( LayeredGraphNode graph )
|
|
|
{
|
|
|
+ stepForward = new NiceButton( "stepForward" );
|
|
|
+ stepForward.setLocation( 10, 10 );
|
|
|
+ stepForwardInto = new NiceButton( "stepForwardInto" );
|
|
|
+ stepForwardInto.setLocation( 60, 10 );
|
|
|
+ stepForwardOut = new NiceButton( "stepForwardOut" );
|
|
|
+ stepForwardOut.setLocation( 110, 10 );
|
|
|
+ runForward = new NiceButton( "runForward" );
|
|
|
+ runForward.setLocation( 160, 10 );
|
|
|
+ runBackward = new NiceButton( "runBackward" );
|
|
|
+ runBackward.setLocation( 160, 60 );
|
|
|
+ stepBackward = new NiceButton( "stepBackward" );
|
|
|
+ stepBackward.setLocation( 10, 60 );
|
|
|
+ //stepBackwardInto = new NiceButton( "" );
|
|
|
+ //stepBackwardInto.setLocation( 60, 60 );
|
|
|
+ stepBackwardOut = new NiceButton( "stepBackwardOut" );
|
|
|
+ stepBackwardOut.setLocation( 110, 60 );
|
|
|
+ pause = new NiceButton( "pause" );
|
|
|
+ pause.setLocation( 210, 10 );
|
|
|
+ debug = new NiceButton( "debug" );
|
|
|
+ debug.setLocation( 350, 10 );
|
|
|
+ delayText = new JLabel( "Delay (ms)" );
|
|
|
+ delayText.setBounds( 260, 10, 80, 20 );
|
|
|
+ delay = new JTextField( "50" );
|
|
|
+ delay.setBounds( 260, 30, 80, 20 );
|
|
|
+
|
|
|
controller = new AnimationController();
|
|
|
- controller.setTimeBetween( 10 );
|
|
|
+ controller.setTimeBetween( 50 );
|
|
|
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.setLocation( 100, 100 );
|
|
@@ -149,6 +195,22 @@ public class MainView {
|
|
|
combined.setSize( 500, 500 );
|
|
|
layne.add( combined, 0 );
|
|
|
frame.add( layne );
|
|
|
+ JPanel menue = new JPanel();
|
|
|
+ menue.setLayout( null );
|
|
|
+ menue.setPreferredSize( new Dimension( 400, 500 ) );
|
|
|
+ menue.add( stepForward );
|
|
|
+ menue.add( stepForwardInto );
|
|
|
+ menue.add( stepForwardOut );
|
|
|
+ menue.add( runForward );
|
|
|
+ menue.add( pause );
|
|
|
+ menue.add( debug );
|
|
|
+ menue.add( stepBackward );
|
|
|
+ menue.add( delayText );
|
|
|
+ menue.add( delay );
|
|
|
+ //menue.add( stepBackwardInto );
|
|
|
+ menue.add( stepBackwardOut );
|
|
|
+ menue.add( runBackward );
|
|
|
+ frame.add( menue, BorderLayout.EAST );
|
|
|
frame.validate();
|
|
|
frame.repaint();
|
|
|
|