From 12d96b44faa3d26fa4f75212d371be69e1ed1199 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 27 May 2005 14:12:36 +0000 Subject: [PATCH] Check if colos are null --- src/jalview/gui/UserDefinedColours.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index a35180b..5fdcdf8 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -28,7 +28,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis super(); frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, "User defined colours", 450,530, false ); + Desktop.addInternalFrame(frame, "User Defined Colours", 450,530, false ); if(System.getProperty("os.name").startsWith("Mac")) frame.setSize(450,560); @@ -145,6 +145,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis { File choice = chooser.getSelectedFile(); jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent()); + jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice.getPath()); Color[] colors = loadColours(choice.getAbsolutePath()); for (int i = 0; i < colors.length; i++) { @@ -166,8 +167,12 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis public static UserColourScheme loadDefaultColours(String file) { UserColourScheme ucs = null; - ucs = new UserColourScheme(loadColours(file)); - ucs.setThreshold(0); + Color cols[] = loadColours(file); + if(cols!=null) + { + ucs = new UserColourScheme(cols); + ucs.setThreshold(0); + } return ucs; } @@ -188,7 +193,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis } catch (Exception ex) - {ex.printStackTrace();} + {System.out.println("Error loading UserColourFile "+file);} return newColours; } -- 1.7.10.2