From 40513f0731d40f708dfe414d75fa335ab47a2391 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 23 Apr 2007 11:47:47 +0000 Subject: [PATCH] check dispalyChar is not null --- src/jalview/gui/AnnotationPanel.java | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 2f444d6..c9fa597 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -821,15 +821,20 @@ public class AnnotationPanel } } - if (av.validCharWidth && validRes && - (row.annotations[column].displayCharacter.length() > 0)) + if (av.validCharWidth && validRes + && row.annotations[column].displayCharacter != null + && (row.annotations[column].displayCharacter.length() > 0)) { int charOffset = (av.charWidth - fm.charWidth(row.annotations[column]. displayCharacter.charAt( 0))) / 2; - g.setColor(row.annotations[column].colour); + + if (row.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(row.annotations[column].colour); if (column == 0 || row.graph > 0) { @@ -1143,7 +1148,11 @@ public class AnnotationPanel continue; } - g.setColor(aa.annotations[column].colour); + if (aa.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[column].colour); + y1 = y - (int) ( ( (aa.annotations[column - 1].value - min) / range) * graphHeight); y2 = y - @@ -1217,7 +1226,11 @@ public class AnnotationPanel continue; } - g.setColor(aa.annotations[column].colour); + if (aa.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[column].colour); + y1 = y - (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight); @@ -1264,7 +1277,10 @@ public class AnnotationPanel { if (aa.annotations[j] != null) { - g.setColor(aa.annotations[j].colour); + if (aa.annotations[j].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[j].colour); height = (int) ( (aa.annotations[j].value / aa.graphMax) * y); if (height > y) -- 1.7.10.2