Browse Source

little improvement

Jessey Widhalm 7 years ago
parent
commit
1d320de4b3
3 changed files with 9 additions and 10 deletions
  1. 7 0
      .checkstyle
  2. BIN
      jars/junit-4.12.jar
  3. 2 10
      src/ui/view/SimulationMenu.java

+ 7 - 0
.checkstyle

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+</fileset-config>

BIN
jars/junit-4.12.jar


+ 2 - 10
src/ui/view/SimulationMenu.java

@@ -80,17 +80,9 @@ public class SimulationMenu extends JMenuBar {
 					File[] files = fileChooser.getSelectedFile().listFiles();
 					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 tmpS = name.lastIndexOf('/');
-							int tmpBS = name.lastIndexOf('\\');
-							int tmpA;
-							if (tmpS > tmpBS) {
-								tmpA = tmpS;
-							} else {
-								tmpA = tmpBS;
-							}
+							String name = files[i].getName();
 							int tmpB = name.lastIndexOf('.');
-							name = name.substring(tmpA + 1, tmpB);
+							name = name.substring(0, tmpB);
 							algosHash.put(name, files[i]);
 							algoCombo.addItem(name);
 						}