2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 import java.awt.event.*;
23 import java.awt.image.*;
26 import jalview.datamodel.*;
34 public class AnnotationPanel extends JPanel implements MouseListener,
35 MouseMotionListener, ActionListener, AdjustmentListener
37 final String HELIX = "Helix";
39 final String SHEET = "Sheet";
41 final String LABEL = "Label";
43 final String REMOVE = "Remove Annotation";
45 final String COLOUR = "Colour";
47 final Color HELIX_COLOUR = Color.red.darker();
49 final Color SHEET_COLOUR = Color.green.darker().darker();
60 BufferedImage fadedImage;
68 boolean fastPaint = false;
70 // Used For mouse Dragging and resizing graphs
71 int graphStretch = -1;
73 int graphStretchY = -1;
75 int min; // used by mouseDragged to see if user
77 int max; // used by mouseDragged to see if user
79 boolean mouseDragging = false;
84 * Creates a new AnnotationPanel object.
89 public AnnotationPanel(AlignmentPanel ap)
92 MAC = new jalview.util.Platform().isAMac();
94 ToolTipManager.sharedInstance().registerComponent(this);
95 ToolTipManager.sharedInstance().setInitialDelay(0);
96 ToolTipManager.sharedInstance().setDismissDelay(10000);
100 addMouseListener(this);
101 addMouseMotionListener(this);
102 ap.annotationScroller.getVerticalScrollBar()
103 .addAdjustmentListener(this);
106 public AnnotationPanel(AlignViewport av)
117 public void adjustmentValueChanged(AdjustmentEvent evt)
119 ap.alabels.setScrollOffset(-evt.getValue());
125 public int adjustPanelHeight()
127 // setHeight of panels
128 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
133 for (int i = 0; i < aa.length; i++)
144 aa[i].height += av.charHeight;
154 aa[i].height += aa[i].graphHeight;
157 if (aa[i].height == 0)
162 height += aa[i].height;
170 this.setPreferredSize(new Dimension(1, height));
181 public void actionPerformed(ActionEvent evt)
183 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
184 Annotation[] anot = aa[activeRow].annotations;
186 if (anot.length < av.getColumnSelection().getMax())
188 Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2];
189 System.arraycopy(anot, 0, temp, 0, anot.length);
191 aa[activeRow].annotations = anot;
194 if (evt.getActionCommand().equals(REMOVE))
196 for (int i = 0; i < av.getColumnSelection().size(); i++)
198 anot[av.getColumnSelection().columnAt(i)] = null;
201 else if (evt.getActionCommand().equals(LABEL))
203 String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL);
204 String label = JOptionPane.showInputDialog(this, "Enter label",
212 if ((label.length() > 0) && !aa[activeRow].hasText)
214 aa[activeRow].hasText = true;
217 for (int i = 0; i < av.getColumnSelection().size(); i++)
219 int index = av.getColumnSelection().columnAt(i);
221 if (!av.colSel.isVisible(index))
224 if (anot[index] == null)
226 anot[index] = new Annotation(label, "", ' ', 0); // TODO: verify that
233 anot[index].displayCharacter = label;
237 else if (evt.getActionCommand().equals(COLOUR))
239 Color col = JColorChooser.showDialog(this,
240 "Choose foreground colour", Color.black);
242 for (int i = 0; i < av.getColumnSelection().size(); i++)
244 int index = av.getColumnSelection().columnAt(i);
246 if (!av.colSel.isVisible(index))
249 if (anot[index] == null)
251 anot[index] = new Annotation("", "", ' ', 0);
254 anot[index].colour = col;
261 String symbol = "\u03B1";
263 if (evt.getActionCommand().equals(HELIX))
267 else if (evt.getActionCommand().equals(SHEET))
273 if (!aa[activeRow].hasIcons)
275 aa[activeRow].hasIcons = true;
278 String label = JOptionPane.showInputDialog(
279 "Enter a label for the structure?", symbol);
286 if ((label.length() > 0) && !aa[activeRow].hasText)
288 aa[activeRow].hasText = true;
291 for (int i = 0; i < av.getColumnSelection().size(); i++)
293 int index = av.getColumnSelection().columnAt(i);
295 if (!av.colSel.isVisible(index))
298 if (anot[index] == null)
300 anot[index] = new Annotation(label, "", type, 0);
303 anot[index].secondaryStructure = type;
304 anot[index].displayCharacter = label;
314 private String collectAnnotVals(Annotation[] anot,
315 ColumnSelection columnSelection, String label2)
317 String collatedInput = "";
319 for (int i = 0; i < columnSelection.size(); i++)
321 int index = columnSelection.columnAt(i);
322 // always check for current display state - just in case
323 if (!av.colSel.isVisible(index))
325 String tlabel = null;
326 if (anot[index] != null)
328 if (label2.equals(HELIX) || label2.equals(SHEET)
329 || label2.equals(LABEL))
331 tlabel = anot[index].description;
334 if (label2.equals(HELIX) || label2.equals(SHEET))
336 tlabel = "" + anot[index].secondaryStructure;
340 tlabel = "" + anot[index].displayCharacter;
344 if (tlabel != null && !tlabel.equals(last))
346 if (last.length() > 0)
348 collatedInput += " ";
350 collatedInput += tlabel;
354 return collatedInput;
363 public void mousePressed(MouseEvent evt)
366 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
375 for (int i = 0; i < aa.length; i++)
379 height += aa[i].height;
382 if (evt.getY() < height)
388 else if (aa[i].graph > 0)
392 graphStretchY = evt.getY();
399 if (SwingUtilities.isRightMouseButton(evt) && activeRow != -1)
401 if (av.getColumnSelection() == null)
406 JPopupMenu pop = new JPopupMenu("Structure type");
407 JMenuItem item = new JMenuItem(HELIX);
408 item.addActionListener(this);
410 item = new JMenuItem(SHEET);
411 item.addActionListener(this);
413 item = new JMenuItem(LABEL);
414 item.addActionListener(this);
416 item = new JMenuItem(COLOUR);
417 item.addActionListener(this);
419 item = new JMenuItem(REMOVE);
420 item.addActionListener(this);
422 pop.show(this, evt.getX(), evt.getY());
432 ap.scalePanel.mousePressed(evt);
442 public void mouseReleased(MouseEvent evt)
446 mouseDragging = false;
447 ap.scalePanel.mouseReleased(evt);
456 public void mouseEntered(MouseEvent evt)
458 ap.scalePanel.mouseEntered(evt);
467 public void mouseExited(MouseEvent evt)
469 ap.scalePanel.mouseExited(evt);
478 public void mouseDragged(MouseEvent evt)
480 if (graphStretch > -1)
482 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
484 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
486 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
488 graphStretchY = evt.getY();
490 ap.paintAlignment(true);
494 ap.scalePanel.mouseDragged(evt);
504 public void mouseMoved(MouseEvent evt)
506 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
510 this.setToolTipText(null);
517 for (int i = 0; i < aa.length; i++)
521 height += aa[i].height;
524 if (evt.getY() < height)
534 this.setToolTipText(null);
538 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
540 if (av.hasHiddenColumns)
542 res = av.getColumnSelection().adjustForHiddenColumns(res);
545 if (aa[row].annotations != null && row > -1
546 && res < (int) aa[row].annotations.length)
548 if (aa[row].graphGroup > -1)
550 StringBuffer tip = new StringBuffer("<html>");
551 for (int gg = 0; gg < aa.length; gg++)
553 if (aa[gg].graphGroup == aa[row].graphGroup
554 && aa[gg].annotations[res] != null)
556 tip.append(aa[gg].label + " "
557 + aa[gg].annotations[res].description + "<br>");
560 if (tip.length() != 6)
562 tip.setLength(tip.length() - 4);
563 this.setToolTipText(tip.toString() + "</html>");
566 else if (aa[row].annotations[res] != null
567 && aa[row].annotations[res].description != null)
569 this.setToolTipText(aa[row].annotations[res].description);
572 if (aa[row].annotations[res] != null)
574 StringBuffer text = new StringBuffer("Sequence position "
577 if (aa[row].annotations[res].description != null)
579 text.append(" " + aa[row].annotations[res].description);
582 ap.alignFrame.statusBar.setText(text.toString());
587 this.setToolTipText(null);
597 public void mouseClicked(MouseEvent evt)
607 public void paintComponent(Graphics g)
609 g.setColor(Color.white);
610 g.fillRect(0, 0, getWidth(), getHeight());
614 if (fastPaint || (getVisibleRect().width != g.getClipBounds().width)
615 || (getVisibleRect().height != g.getClipBounds().height))
617 g.drawImage(image, 0, 0, this);
622 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
625 if (image == null || imgWidth != image.getWidth()
626 || image.getHeight(this) != getHeight())
628 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
629 BufferedImage.TYPE_INT_RGB);
630 gg = (Graphics2D) image.getGraphics();
634 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
635 RenderingHints.VALUE_ANTIALIAS_ON);
638 gg.setFont(av.getFont());
639 fm = gg.getFontMetrics();
640 gg.setColor(Color.white);
641 gg.fillRect(0, 0, imgWidth, image.getHeight());
644 drawComponent(gg, av.startRes, av.endRes + 1);
645 g.drawImage(image, 0, 0, this);
649 * non-Thread safe repaint
652 * repaint with horizontal shift in alignment
654 public void fastPaint(int horizontal)
657 if ((horizontal == 0) || gg == null
658 || av.alignment.getAlignmentAnnotation() == null
659 || av.alignment.getAlignmentAnnotation().length < 1
660 || av.updatingConsensus || av.updatingConservation)
665 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
667 int sr = av.startRes;
668 int er = av.endRes + 1;
671 if (horizontal > 0) // scrollbar pulled right, image to the left
673 transX = (er - sr - horizontal) * av.charWidth;
674 sr = er - horizontal;
676 else if (horizontal < 0)
678 er = sr - horizontal;
681 gg.translate(transX, 0);
683 drawComponent(gg, sr, er);
685 gg.translate(-transX, 0);
702 public void drawComponent(Graphics g, int startRes, int endRes)
704 if (av.updatingConsensus || av.updatingConservation)
710 // We'll keep a record of the old image,
711 // and draw a faded image until the calculation
713 if (fadedImage == null || fadedImage.getWidth() != imgWidth
714 || fadedImage.getHeight() != image.getHeight())
716 fadedImage = new BufferedImage(imgWidth, image.getHeight(),
717 BufferedImage.TYPE_INT_RGB);
719 Graphics2D fadedG = (Graphics2D) fadedImage.getGraphics();
721 fadedG.setColor(Color.white);
722 fadedG.fillRect(0, 0, imgWidth, image.getHeight());
724 fadedG.setComposite(AlphaComposite.getInstance(
725 AlphaComposite.SRC_OVER, .3f));
726 fadedG.drawImage(image, 0, 0, this);
736 g.setColor(Color.white);
737 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
739 g.setFont(av.getFont());
742 fm = g.getFontMetrics();
745 if ((av.alignment.getAlignmentAnnotation() == null)
746 || (av.alignment.getAlignmentAnnotation().length < 1))
748 g.setColor(Color.white);
749 g.fillRect(0, 0, getWidth(), getHeight());
750 g.setColor(Color.black);
751 if (av.validCharWidth)
753 g.drawString("Alignment has no annotations", 20, 15);
759 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
766 boolean validRes = false;
767 boolean validEnd = false;
768 boolean[] graphGroupDrawn = new boolean[aa.length];
771 for (int i = 0; i < aa.length; i++)
773 AlignmentAnnotation row = aa[i];
785 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
790 // this is so that we draw the characters below the graph
795 iconOffset = av.charHeight - fm.getDescent();
799 else if (row.hasText)
801 iconOffset = av.charHeight - fm.getDescent();
809 if (av.updatingConsensus && aa[i] == av.consensus)
813 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
814 - row.height, imgWidth, y, this);
815 g.setColor(Color.black);
816 // g.drawString("Calculating Consensus....",20, y-row.height/2);
820 else if (av.updatingConservation
821 && aa[i].label.equals("Conservation"))
825 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
826 - row.height, imgWidth, y, this);
828 g.setColor(Color.black);
829 // g.drawString("Calculating Conservation.....",20, y-row.height/2);
833 else if (av.updatingConservation && aa[i].label.equals("Quality"))
837 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
838 - row.height, imgWidth, y, this);
839 g.setColor(Color.black);
840 // / g.drawString("Calculating Quality....",20, y-row.height/2);
846 while (x < endRes - startRes)
848 if (av.hasHiddenColumns)
850 column = av.getColumnSelection().adjustForHiddenColumns(
852 if (column > row.annotations.length - 1)
859 column = startRes + x;
862 if ((row.annotations == null) || (row.annotations.length <= column)
863 || (row.annotations[column] == null))
874 g.setColor(Color.red);
876 if (av.getColumnSelection() != null)
878 for (int n = 0; n < av.getColumnSelection().size(); n++)
880 int v = av.getColumnSelection().columnAt(n);
885 .fillRect(x * av.charWidth, y, av.charWidth,
892 if (av.validCharWidth && validRes
893 && row.annotations[column].displayCharacter != null
894 && (row.annotations[column].displayCharacter.length() > 0))
897 int charOffset = (av.getCentreColumnLabels()) ? ((av.charWidth - fm
898 .charsWidth(row.annotations[column].displayCharacter
900 row.annotations[column].displayCharacter.length())) / 2)
902 .charWidth(row.annotations[column].displayCharacter
905 if (row.annotations[column].colour == null)
906 g.setColor(Color.black);
908 g.setColor(row.annotations[column].colour);
910 if (column == 0 || row.graph > 0)
912 g.drawString(row.annotations[column].displayCharacter,
913 (x * av.charWidth) + charOffset, y + iconOffset);
915 else if (row.annotations[column - 1] == null
916 || (!row.annotations[column].displayCharacter
917 .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
918 .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
920 g.drawString(row.annotations[column].displayCharacter, x
921 * av.charWidth + charOffset, y + iconOffset);
928 || (row.annotations[column].secondaryStructure != lastSS))
933 g.setColor(HELIX_COLOUR);
936 // Off by 1 offset when drawing rects and ovals
937 // to offscreen image on the MAC
938 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
939 (x * av.charWidth) - lastSSX, 7, 8, 8);
943 int sCol = (lastSSX / av.charWidth) + startRes;
945 int x2 = (x * av.charWidth);
948 || row.annotations[sCol - 1] == null
949 || row.annotations[sCol - 1].secondaryStructure != 'H')
951 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
953 x1 += av.charWidth / 2;
956 if (row.annotations[column] == null
957 || row.annotations[column].secondaryStructure != 'H')
959 g.fillArc((x * av.charWidth) - av.charWidth, y + 4
960 + iconOffset, av.charWidth, 8, 270, 180);
961 x2 -= av.charWidth / 2;
964 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
968 g.setColor(SHEET_COLOUR);
969 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
971 g.fillPolygon(new int[]
972 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
973 (x * av.charWidth) }, new int[]
974 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
980 g.setColor(Color.gray);
981 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
989 lastSS = row.annotations[column].secondaryStructure;
996 lastSSX = (x * av.charWidth);
1004 if (column >= row.annotations.length)
1006 column = row.annotations.length - 1;
1021 g.setColor(HELIX_COLOUR);
1024 // Off by 1 offset when drawing rects and ovals
1025 // to offscreen image on the MAC
1026 g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
1027 - lastSSX, 7, 8, 8);
1031 int sCol = (lastSSX / av.charWidth) + startRes;
1033 int x2 = (x * av.charWidth);
1035 if (sCol == 0 || row.annotations[sCol - 1] == null
1036 || row.annotations[sCol - 1].secondaryStructure != 'H')
1039 .fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8,
1041 x1 += av.charWidth / 2;
1044 if (row.annotations[column] == null
1045 || row.annotations[column].secondaryStructure != 'H')
1047 g.fillArc((x * av.charWidth) - av.charWidth,
1048 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
1049 x2 -= av.charWidth / 2;
1052 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
1057 g.setColor(SHEET_COLOUR);
1059 if (!validEnd || row.annotations[endRes] == null
1060 || row.annotations[endRes].secondaryStructure != 'E')
1062 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
1064 g.fillPolygon(new int[]
1065 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
1066 (x * av.charWidth) }, new int[]
1067 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
1071 g.fillRect(lastSSX, y + 4 + iconOffset, (x + 1) * av.charWidth
1077 g.setColor(Color.gray);
1078 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
1085 if (row.graph > 0 && row.graphHeight > 0)
1087 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
1089 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
1091 float groupmax = -999999, groupmin = 9999999;
1092 for (int gg = 0; gg < aa.length; gg++)
1094 if (aa[gg].graphGroup != row.graphGroup)
1101 aa[gg].visible = false;
1104 if (aa[gg].graphMax > groupmax)
1106 groupmax = aa[gg].graphMax;
1108 if (aa[gg].graphMin < groupmin)
1110 groupmin = aa[gg].graphMin;
1114 for (int gg = 0; gg < aa.length; gg++)
1116 if (aa[gg].graphGroup == row.graphGroup)
1118 drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
1119 groupmax, row.graphHeight);
1123 graphGroupDrawn[row.graphGroup] = true;
1127 drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
1128 row.graphMax, row.graphHeight);
1131 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
1133 drawBarGraph(g, row, startRes, endRes, row.graphMin,
1138 if (row.graph > 0 && row.hasText)
1150 public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1151 int eRes, int y, float min, float max, int graphHeight)
1153 if (sRes > aa.annotations.length)
1160 // Adjustment for fastpaint to left
1161 if (eRes < av.endRes)
1166 eRes = Math.min(eRes, aa.annotations.length);
1174 float range = max - min;
1179 y2 = y - (int) ((0 - min / range) * graphHeight);
1182 g.setColor(Color.gray);
1183 g.drawLine(x - av.charWidth, y2, (eRes - sRes + 1) * av.charWidth, y2);
1185 eRes = Math.min(eRes, aa.annotations.length);
1188 int aaMax = aa.annotations.length - 1;
1190 while (x < eRes - sRes)
1193 if (av.hasHiddenColumns)
1195 column = av.getColumnSelection().adjustForHiddenColumns(column);
1203 if (aa.annotations[column] == null
1204 || aa.annotations[column - 1] == null)
1210 if (aa.annotations[column].colour == null)
1211 g.setColor(Color.black);
1213 g.setColor(aa.annotations[column].colour);
1216 - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
1218 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1220 g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
1221 + av.charWidth / 2, y2);
1225 if (aa.threshold != null)
1227 g.setColor(aa.threshold.colour);
1228 Graphics2D g2 = (Graphics2D) g;
1229 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
1230 BasicStroke.JOIN_ROUND, 3f, new float[]
1233 y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
1234 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1235 g2.setStroke(new BasicStroke());
1239 public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1240 int eRes, float min, float max, int y)
1242 if (sRes > aa.annotations.length)
1247 eRes = Math.min(eRes, aa.annotations.length);
1249 int x = 0, y1 = y, y2 = y;
1251 float range = max - min;
1255 y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
1258 g.setColor(Color.gray);
1260 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1263 int aaMax = aa.annotations.length - 1;
1265 while (x < eRes - sRes)
1268 if (av.hasHiddenColumns)
1270 column = av.getColumnSelection().adjustForHiddenColumns(column);
1278 if (aa.annotations[column] == null)
1284 if (aa.annotations[column].colour == null)
1285 g.setColor(Color.black);
1287 g.setColor(aa.annotations[column].colour);
1290 - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1294 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1298 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1304 if (aa.threshold != null)
1306 g.setColor(aa.threshold.colour);
1307 Graphics2D g2 = (Graphics2D) g;
1308 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
1309 BasicStroke.JOIN_ROUND, 3f, new float[]
1312 y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
1313 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1314 g2.setStroke(new BasicStroke());
1318 // used by overview window
1319 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
1320 int y, int sRes, int eRes)
1322 eRes = Math.min(eRes, aa.annotations.length);
1323 g.setColor(Color.white);
1324 g.fillRect(0, 0, width, y);
1325 g.setColor(new Color(0, 0, 180));
1329 for (int j = sRes; j < eRes; j++)
1331 if (aa.annotations[j] != null)
1333 if (aa.annotations[j].colour == null)
1334 g.setColor(Color.black);
1336 g.setColor(aa.annotations[j].colour);
1338 height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
1344 g.fillRect(x, y - height, av.charWidth, height);