Browse Source

changed image save path to home directory

Jessey Widhalm 8 years ago
parent
commit
a8f88496aa
2 changed files with 12 additions and 19 deletions
  1. 6 15
      src/ui/view/AddObjectPopUp.java
  2. 6 4
      src/ui/view/PropertyTable.java

+ 6 - 15
src/ui/view/AddObjectPopUp.java

@@ -276,23 +276,14 @@ public class AddObjectPopUp extends JDialog {
 	protected void copieFile() {
 		InputStream inStream = null;
 		OutputStream outStream = null;
-		String jarLocation = "";
 		try {
 			File source = new File(filePath);
-			// File dest = new File(System.getProperty("user.dir") +
-			// "/bin/Images/", selectedFile.getName());
-			// imagePath = "/Images/" + selectedFile.getName();
-			try {
-				jarLocation = getJarContainingFolder(this.getClass());
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			File dest = new File(jarLocation + "/HolonGUI/Images/");
-			dest.mkdirs();
-
-			dest = new File(dest, selectedFile.getName());
-			imagePath = jarLocation + "/HolonGUI/Images/" + selectedFile.getName();
+			File dest = new File(System.getProperty("user.home") + "/HolonGUI/Images/");
+		
+			 dest.mkdirs();
+			 dest = new File(dest, selectedFile.getName());
+			 imagePath = "" + dest;
+			
 			inStream = new FileInputStream(source);
 			outStream = new FileOutputStream(dest);
 			byte[] buffer = new byte[1024];

+ 6 - 4
src/ui/view/PropertyTable.java

@@ -9,10 +9,12 @@ public class PropertyTable extends DefaultTableModel {
 	@Override
 	public Class<?> getColumnClass(int columnIndex) {
 		Class clazz = String.class;
-		switch (columnIndex) {
-		case 3:
-			clazz = Boolean.class;
-			break;
+		if (getRowCount() == 2) {
+			switch (columnIndex) {
+			case 3:
+				clazz = Boolean.class;
+				break;
+			}
 		}
 		return clazz;
 	}