|
@@ -51,7 +51,7 @@ public class SimulationMenu extends JMenuBar {
|
|
|
private JComboBox algoCombo = new JComboBox<>();
|
|
|
private JButton algoFolderButton = new JButton("Algorithm:");
|
|
|
private HashMap<String, File> algosHash = new HashMap<>();
|
|
|
-
|
|
|
+
|
|
|
Model model;
|
|
|
Control controller;
|
|
|
|
|
@@ -81,9 +81,16 @@ public class SimulationMenu extends JMenuBar {
|
|
|
for (int i = 0; i < files.length; i++) {
|
|
|
if (files[i].toString().endsWith(".java") || files[i].toString().endsWith(".class")) {
|
|
|
String name = files[i].toString();
|
|
|
- int tmpA = name.lastIndexOf('/');
|
|
|
+ int tmpS = name.lastIndexOf('/');
|
|
|
+ int tmpBS = name.lastIndexOf('\\');
|
|
|
+ int tmpA;
|
|
|
+ if (tmpS > tmpBS) {
|
|
|
+ tmpA = tmpS;
|
|
|
+ } else {
|
|
|
+ tmpA = tmpBS;
|
|
|
+ }
|
|
|
int tmpB = name.lastIndexOf('.');
|
|
|
- name = name.substring(tmpA+1, tmpB);
|
|
|
+ name = name.substring(tmpA + 1, tmpB);
|
|
|
algosHash.put(name, files[i]);
|
|
|
algoCombo.addItem(name);
|
|
|
}
|
|
@@ -156,8 +163,8 @@ public class SimulationMenu extends JMenuBar {
|
|
|
gbc_algoCombo.gridy = 0;
|
|
|
menuPanel.add(algoCombo, gbc_algoCombo);
|
|
|
algoCombo.addItem("choose folder");
|
|
|
-
|
|
|
- //Add Panel to SimulationMenu
|
|
|
+
|
|
|
+ // Add Panel to SimulationMenu
|
|
|
this.add(menuPanel);
|
|
|
}
|
|
|
}
|