|
@@ -1,28 +1,102 @@
|
|
package ui.view;
|
|
package ui.view;
|
|
|
|
|
|
-import javax.swing.JButton;
|
|
|
|
|
|
+import javax.swing.JComboBox;
|
|
|
|
+import javax.swing.JLabel;
|
|
import javax.swing.JMenuBar;
|
|
import javax.swing.JMenuBar;
|
|
-import javax.swing.JMenuItem;
|
|
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JRadioButton;
|
|
import javax.swing.JRadioButton;
|
|
|
|
+import javax.swing.JTextField;
|
|
|
|
+import javax.swing.event.CaretEvent;
|
|
|
|
+import javax.swing.event.CaretListener;
|
|
|
|
+
|
|
|
|
+import com.sun.org.apache.regexp.internal.recompile;
|
|
|
|
|
|
import ui.controller.Control;
|
|
import ui.controller.Control;
|
|
import ui.model.Model;
|
|
import ui.model.Model;
|
|
-import java.awt.BorderLayout;
|
|
|
|
-import java.awt.MenuItem;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+
|
|
|
|
+import java.awt.GridBagLayout;
|
|
|
|
+import java.awt.Dimension;
|
|
|
|
+import java.awt.GridBagConstraints;
|
|
|
|
+import java.awt.Insets;
|
|
|
|
+import java.beans.PropertyChangeEvent;
|
|
|
|
+import java.beans.PropertyChangeListener;
|
|
|
|
|
|
public class SimulationMenu extends JMenuBar {
|
|
public class SimulationMenu extends JMenuBar {
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
|
|
|
private Model model;
|
|
private Model model;
|
|
private Control controller;
|
|
private Control controller;
|
|
|
|
|
|
|
|
+ // Components
|
|
|
|
+ private JPanel simMenuPanel = new JPanel();
|
|
|
|
+ private JRadioButton simButton = new JRadioButton("Simulate");
|
|
|
|
+ private JLabel simSpeedLabel = new JLabel("Simulation Speed: ");
|
|
|
|
+ private JTextField simSpeedText = new JTextField("10000000");
|
|
|
|
+ private JLabel algoLabel = new JLabel("Algorithm: ");
|
|
|
|
+ private JComboBox algoCombo;
|
|
|
|
+ private ArrayList<String> algos = new ArrayList<>();
|
|
|
|
+
|
|
public SimulationMenu(Model mod, Control cont) {
|
|
public SimulationMenu(Model mod, Control cont) {
|
|
super();
|
|
super();
|
|
this.model = mod;
|
|
this.model = mod;
|
|
this.controller = cont;
|
|
this.controller = cont;
|
|
-
|
|
|
|
- this.add(new JRadioButton("Simulate"));
|
|
|
|
- this.add(new JButton("testbutton"));
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ // Init Stuff
|
|
|
|
+ algos.add("algorithm1");
|
|
|
|
+ algos.add("algorithm2");
|
|
|
|
+ algos.add("algorithm3");
|
|
|
|
+ simSpeedText.setMaximumSize(new Dimension(300, 300));
|
|
|
|
+ simSpeedText.addCaretListener(new CaretListener() {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void caretUpdate(CaretEvent e) {
|
|
|
|
+ System.out.println("test");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // Add to Panel
|
|
|
|
+ JPanel menuPanel = new JPanel();
|
|
|
|
+ GridBagLayout gbl_t = new GridBagLayout();
|
|
|
|
+ gbl_t.columnWidths = new int[] { 79, 109, 46, 64, 31, 0 };
|
|
|
|
+ gbl_t.rowHeights = new int[] { 25, 0 };
|
|
|
|
+ gbl_t.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
|
|
|
|
+ gbl_t.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
|
|
|
|
+ menuPanel.setLayout(gbl_t);
|
|
|
|
+
|
|
|
|
+ GridBagConstraints gbc_simButton = new GridBagConstraints();
|
|
|
|
+ gbc_simButton.anchor = GridBagConstraints.NORTHWEST;
|
|
|
|
+ gbc_simButton.insets = new Insets(0, 0, 0, 5);
|
|
|
|
+ gbc_simButton.gridx = 0;
|
|
|
|
+ gbc_simButton.gridy = 0;
|
|
|
|
+ menuPanel.add(simButton, gbc_simButton);
|
|
|
|
+ GridBagConstraints gbc_simSpeedLabel = new GridBagConstraints();
|
|
|
|
+ gbc_simSpeedLabel.anchor = GridBagConstraints.WEST;
|
|
|
|
+ gbc_simSpeedLabel.insets = new Insets(0, 0, 0, 5);
|
|
|
|
+ gbc_simSpeedLabel.gridx = 1;
|
|
|
|
+ gbc_simSpeedLabel.gridy = 0;
|
|
|
|
+ menuPanel.add(simSpeedLabel, gbc_simSpeedLabel);
|
|
|
|
+ GridBagConstraints gbc_simSpeedText = new GridBagConstraints();
|
|
|
|
+ gbc_simSpeedText.anchor = GridBagConstraints.WEST;
|
|
|
|
+ gbc_simSpeedText.insets = new Insets(0, 0, 0, 5);
|
|
|
|
+ gbc_simSpeedText.gridx = 2;
|
|
|
|
+ gbc_simSpeedText.gridy = 0;
|
|
|
|
+ menuPanel.add(simSpeedText, gbc_simSpeedText);
|
|
|
|
+ GridBagConstraints gbc_algoLabel = new GridBagConstraints();
|
|
|
|
+ gbc_algoLabel.anchor = GridBagConstraints.WEST;
|
|
|
|
+ gbc_algoLabel.insets = new Insets(0, 0, 0, 5);
|
|
|
|
+ gbc_algoLabel.gridx = 3;
|
|
|
|
+ gbc_algoLabel.gridy = 0;
|
|
|
|
+ menuPanel.add(algoLabel, gbc_algoLabel);
|
|
|
|
+
|
|
|
|
+ algoCombo = new JComboBox<Object>(algos.toArray());
|
|
|
|
+ GridBagConstraints gbc_algoCombo = new GridBagConstraints();
|
|
|
|
+ gbc_algoCombo.anchor = GridBagConstraints.WEST;
|
|
|
|
+ gbc_algoCombo.gridx = 4;
|
|
|
|
+ gbc_algoCombo.gridy = 0;
|
|
|
|
+ menuPanel.add(algoCombo, gbc_algoCombo);
|
|
|
|
+ this.add(menuPanel);
|
|
|
|
+ }
|
|
}
|
|
}
|