public void adjustPanelHeight()\r
{\r
// setHeight of panels\r
+ image = null;\r
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
int height = 0;\r
\r
if (activeRow == -1)\r
{\r
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ if(aa==null)\r
+ return;\r
\r
for (int j = 0; j < aa.length; j++)\r
{\r
if (activeRow == -1)\r
{\r
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ if(aa==null)\r
+ return;\r
\r
for (int j = 0; j < aa.length; j++)\r
{\r
\r
for (int i = 0; i < aa.length; i++)\r
{\r
- height += aa[i].height;\r
+ if (aa[i].visible)\r
+ {\r
+ height += aa[i].height;\r
+ }\r
\r
if (evt.getY() < height)\r
{\r
*/\r
public void paintComponent(Graphics g)\r
{\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
\r
- if (fastPaint)\r
- {\r
- g.drawImage(image, 0, 0, this);\r
- fastPaint = false;\r
-\r
- return;\r
- }\r
+ if (fastPaint && image!=null)\r
+ {\r
+ g.drawImage(image, 0, 0, this);\r
+ fastPaint = false;\r
+ return;\r
+ }\r
\r
- imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
+ imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
\r
+ if (image == null || imgWidth != image.getWidth())\r
+ {\r
image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
- BufferedImage.TYPE_INT_RGB);\r
+ BufferedImage.TYPE_INT_RGB);\r
gg = (Graphics2D) image.getGraphics();\r
gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
gg.setFont(av.getFont());\r
+ fm = gg.getFontMetrics();\r
+ }\r
\r
- drawComponent(gg, av.startRes, av.endRes + 1);\r
- g.drawImage(image, 0, 0, this);\r
+ drawComponent(gg, av.startRes, av.endRes + 1);\r
+ g.drawImage(image, 0, 0, this);\r
}\r
\r
/**\r
gg.translate(-transX, 0);\r
\r
fastPaint = true;\r
+\r
repaint();\r
+\r
}\r
\r
/**\r
*/\r
public void drawComponent(Graphics2D g, int startRes, int endRes)\r
{\r
- if(fm==null)\r
+ if (fm == null)\r
fm = g.getFontMetrics();\r
\r
+ if(fm==null)\r
+ fm = g.getFontMetrics();\r
+\r
g.setColor(Color.white);\r
g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());\r
\r
continue;\r
}\r
\r
+\r
if (row.isGraph)\r
{\r
// this is so that we draw the characters below the graph\r
if (j == 0 || row.isGraph)\r
{\r
g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
- y + iconOffset + 2);\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 + 2);\r
+ y + iconOffset + 3);\r
}\r
}\r
\r
}\r
\r
// used by overview window\r
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y)\r
+ public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)\r
{\r
g.setColor(Color.white);\r
g.fillRect(0, 0, width, y);\r
g.setColor(new Color(0, 0, 180));\r
\r
- int x = 0;\r
\r
- for (int j = 0; j < aa.annotations.length; j++)\r
+ int x = 0, height;\r
+\r
+ for (int j = sRes; j < eRes; j++)\r
{\r
g.setColor(new Color(0, 0, 180));\r
\r
- int height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
+ height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
+ if(height>y)\r
+ height = y;\r
+\r
g.fillRect(x, y - height, av.charWidth, height);\r
x += av.charWidth;\r
}\r