+ if ((row.annotations.length <= j) ||\r
+ (row.annotations[j] == null))\r
+ {\r
+ validRes = false;\r
+ }\r
+ else\r
+ {\r
+ validRes = true;\r
+ }\r
+\r
+ x = (j - startRes) * av.charWidth;\r
+\r
+ if (activeRow == i)\r
+ {\r
+ g.setColor(Color.red);\r
+\r
+ if (activeRes != null)\r
+ {\r
+ for (int n = 0; n < activeRes.size(); n++)\r
+ {\r
+ int v = Integer.parseInt(activeRes.elementAt(n).toString());\r
+\r
+ if (v == j)\r
+ {\r
+ g.fillRect((j - startRes) * av.charWidth, y,\r
+ av.charWidth, row.height);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (validRes &&\r
+ (row.annotations[j].displayCharacter.length() > 0))\r
+ {\r
+\r
+ int charOffset = (av.charWidth -\r
+ fm.charWidth(row.annotations[j].displayCharacter.charAt(\r
+ 0))) / 2;\r
+ g.setColor(row.annotations[j].colour);\r
+\r
+ if (j == 0 || row.graph>0)\r
+ {\r
+ g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
+ y + iconOffset + 3);\r
+ }\r
+ else if (((row.annotations[j - 1] == null) ||\r
+ (row.annotations[j].displayCharacter != row.annotations[j -\r
+ 1].displayCharacter)))\r
+ {\r
+ g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
+ y + iconOffset + 3);\r
+ }\r
+ }\r
+\r
+ if (row.hasIcons)\r
+ {\r
+ if (!validRes ||\r
+ (row.annotations[j].secondaryStructure != lastSS[i]))\r
+ {\r
+ switch (lastSS[i])\r
+ {\r
+ case 'H':\r
+ g.setColor(HELIX_COLOUR);\r
+ g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i], 7, 8, 8);\r
+\r
+ break;\r
+\r
+ case 'E':\r
+ g.setColor(SHEET_COLOUR);\r
+ g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i] - 4, 7);\r
+ g.fillPolygon(new int[] { x - 4, x - 4, x },\r
+ new int[]\r
+ {\r
+ y + iconOffset, y + 14 + iconOffset,\r
+ y + 8 + iconOffset\r
+ }, 3);\r
+\r
+ break;\r
+\r
+\r
+ default:\r
+ g.setColor(Color.gray);\r
+ g.fillRect(lastSSX[i], y + 6 + iconOffset,\r
+ x - lastSSX[i], 2);\r
+\r
+ break;\r
+ }\r
+\r
+ if (validRes)\r
+ {\r
+ lastSS[i] = row.annotations[j].secondaryStructure;\r
+ }\r
+ else\r
+ {\r
+ lastSS[i] = ' ';\r
+ }\r
+\r
+ lastSSX[i] = x;\r
+ }\r
+ }\r