Applet Structure viewer has all colours available
[jalview.git] / src / MCview / PDBCanvas.java
index 17db1a0..6014455 100755 (executable)
@@ -72,6 +72,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
     PDBChain mainchain;\r
     Vector highlightRes;\r
     boolean pdbAction = false;\r
+    boolean seqColoursReady = false;\r
 \r
     public PDBCanvas(jalview.gui.SeqCanvas seqcanvas, Sequence seq)\r
     {\r
@@ -198,6 +199,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
     Vector visiblebonds;\r
     void setupBonds()\r
     {\r
+      seqColoursReady = false;\r
       // Sort the bonds by z coord\r
       visiblebonds = new Vector();\r
 \r
@@ -215,6 +217,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
       }\r
 \r
       updateSeqColours();\r
+      seqColoursReady = true;\r
       redrawneeded = true;\r
       repaint();\r
     }\r
@@ -369,7 +372,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
     {\r
       super.paintComponent(g);\r
 \r
-      if(visiblebonds==null)\r
+      if(!seqColoursReady)\r
       {\r
         g.setColor(Color.black);\r
         g.setFont(new Font("Verdana", Font.BOLD, 14));\r
@@ -929,6 +932,8 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
    Bond highlightBond1, highlightBond2;\r
    public void highlightRes(int ii)\r
   {\r
+    if( !seqColoursReady )\r
+      return;\r
 \r
     if (highlightRes != null\r
         && highlightRes.contains((ii-1) + ""))\r