2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.gui;
\r
21 import jalview.datamodel.*;
\r
24 import java.awt.event.*;
\r
25 import java.awt.image.*;
\r
27 import javax.swing.*;
\r
34 * @version $Revision$
\r
36 public class AnnotationPanel extends JPanel implements MouseListener,
\r
37 MouseMotionListener, ActionListener, AdjustmentListener
\r
39 final String HELIX = "Helix";
\r
40 final String SHEET = "Sheet";
\r
41 final String LABEL = "Label";
\r
42 final String REMOVE = "Remove Annotation";
\r
43 final String COLOUR = "Colour";
\r
44 final Color HELIX_COLOUR = Color.red.darker();
\r
45 final Color SHEET_COLOUR = Color.green.darker().darker();
\r
47 /** DOCUMENT ME!! */
\r
51 BufferedImage image;
\r
54 boolean validCharWidth;
\r
56 boolean fastPaint = false;
\r
58 //Used For mouse Dragging and resizing graphs
\r
59 int graphStretch = -1;
\r
60 int graphStretchY = -1;
\r
61 int min; //used by mouseDragged to see if user
\r
62 int max; //used by mouseDragged to see if user
\r
63 boolean mouseDragging = false;
\r
66 * Creates a new AnnotationPanel object.
\r
68 * @param ap DOCUMENT ME!
\r
70 public AnnotationPanel(AlignmentPanel ap)
\r
72 ToolTipManager.sharedInstance().registerComponent(this);
\r
73 ToolTipManager.sharedInstance().setInitialDelay(0);
\r
74 ToolTipManager.sharedInstance().setDismissDelay(10000);
\r
77 this.setLayout(null);
\r
78 addMouseListener(this);
\r
79 addMouseMotionListener(this);
\r
80 ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);
\r
83 public AnnotationPanel(AlignViewport av)
\r
92 * @param evt DOCUMENT ME!
\r
94 public void adjustmentValueChanged(AdjustmentEvent evt)
\r
96 ap.alabels.setScrollOffset(-evt.getValue());
\r
102 public int adjustPanelHeight()
\r
104 // setHeight of panels
\r
106 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
111 for (int i = 0; i < aa.length; i++)
\r
113 if (!aa[i].visible)
\r
122 aa[i].height += av.charHeight;
\r
125 if (aa[i].hasIcons)
\r
127 aa[i].height += 16;
\r
132 aa[i].height += aa[i].graphHeight;
\r
135 if (aa[i].height == 0)
\r
140 height += aa[i].height;
\r
148 this.setPreferredSize(new Dimension(1, height));
\r
158 * @param evt DOCUMENT ME!
\r
160 public void actionPerformed(ActionEvent evt)
\r
162 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
163 Annotation[] anot = aa[activeRow].annotations;
\r
165 if (evt.getActionCommand().equals(REMOVE))
\r
167 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
169 anot[av.getColumnSelection().columnAt(i)] = null;
\r
172 else if (evt.getActionCommand().equals(LABEL))
\r
174 String label = JOptionPane.showInputDialog(this, "Enter Label ",
\r
175 "Enter label", JOptionPane.QUESTION_MESSAGE);
\r
182 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
184 aa[activeRow].hasText = true;
\r
187 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
189 int index = av.getColumnSelection().columnAt(i);
\r
191 if (anot[index] == null)
\r
193 anot[index] = new Annotation(label, "", ' ', 0);
\r
196 anot[index].displayCharacter = label;
\r
199 else if (evt.getActionCommand().equals(COLOUR))
\r
201 Color col = JColorChooser.showDialog(this,
\r
202 "Choose foreground colour", Color.black);
\r
204 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
206 int index = av.getColumnSelection().columnAt(i);
\r
208 if (anot[index] == null)
\r
210 anot[index] = new Annotation("", "", ' ', 0);
\r
213 anot[index].colour = col;
\r
216 else // HELIX OR SHEET
\r
219 String symbol = "\u03B1";
\r
221 if (evt.getActionCommand().equals(HELIX))
\r
225 else if (evt.getActionCommand().equals(SHEET))
\r
231 if (!aa[activeRow].hasIcons)
\r
233 aa[activeRow].hasIcons = true;
\r
236 String label = JOptionPane.showInputDialog("Enter a label for the structure?",
\r
244 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
246 aa[activeRow].hasText = true;
\r
249 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
251 int index = av.getColumnSelection().columnAt(i);
\r
253 if (anot[index] == null)
\r
255 anot[index] = new Annotation(label, "", type, 0);
\r
258 anot[index].secondaryStructure = type;
\r
259 anot[index].displayCharacter = label;
\r
263 adjustPanelHeight();
\r
272 * @param evt DOCUMENT ME!
\r
274 public void mousePressed(MouseEvent evt)
\r
279 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
283 for (int i = 0; i < aa.length; i++)
\r
287 height += aa[i].height;
\r
290 if (evt.getY() < height)
\r
292 if (aa[i].editable)
\r
296 else if(aa[i].graph>0)
\r
300 graphStretchY = evt.getY();
\r
307 if (SwingUtilities.isRightMouseButton(evt))
\r
309 if (av.getColumnSelection() == null)
\r
314 JPopupMenu pop = new JPopupMenu("Structure type");
\r
315 JMenuItem item = new JMenuItem(HELIX);
\r
316 item.addActionListener(this);
\r
318 item = new JMenuItem(SHEET);
\r
319 item.addActionListener(this);
\r
321 item = new JMenuItem(LABEL);
\r
322 item.addActionListener(this);
\r
324 item = new JMenuItem(COLOUR);
\r
325 item.addActionListener(this);
\r
327 item = new JMenuItem(REMOVE);
\r
328 item.addActionListener(this);
\r
330 pop.show(this, evt.getX(), evt.getY());
\r
340 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
345 if (av.getColumnSelection().contains(res))
\r
346 av.getColumnSelection().removeElement(res);
\r
349 av.getColumnSelection().addElement(res);
\r
350 SequenceGroup sg = new SequenceGroup();
\r
352 for (int i = 0; i < av.alignment.getSequences().size(); i++)
\r
354 sg.addSequence(av.alignment.getSequenceAt(i), false);
\r
357 sg.setStartRes(res);
\r
359 av.setSelectionGroup(sg);
\r
369 * @param evt DOCUMENT ME!
\r
371 public void mouseReleased(MouseEvent evt)
\r
374 graphStretchY = -1;
\r
375 mouseDragging = false;
\r
381 * @param evt DOCUMENT ME!
\r
383 public void mouseEntered(MouseEvent evt)
\r
386 ap.seqPanel.scrollCanvas(null);
\r
392 * @param evt DOCUMENT ME!
\r
394 public void mouseExited(MouseEvent evt)
\r
397 ap.seqPanel.scrollCanvas(evt);
\r
404 * @param evt DOCUMENT ME!
\r
406 public void mouseDragged(MouseEvent evt)
\r
408 if(graphStretch>-1)
\r
410 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - evt.getY();
\r
411 if(av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight <10)
\r
412 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 10;
\r
413 graphStretchY = evt.getY();
\r
414 adjustPanelHeight();
\r
419 mouseDragging = true;
\r
421 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
423 SequenceGroup sg = av.getSelectionGroup();
\r
437 if (!av.getColumnSelection().contains(res))
\r
439 av.getColumnSelection().addElement(res);
\r
442 if (res > sg.getStartRes())
\r
446 else if (res < sg.getStartRes())
\r
448 sg.setStartRes(res);
\r
451 for (int i = min; i <= max; i++)
\r
453 if ((i < sg.getStartRes()) || (i > sg.getEndRes()))
\r
455 av.getColumnSelection().removeElement(i);
\r
459 av.getColumnSelection().addElement(i);
\r
472 * @param evt DOCUMENT ME!
\r
474 public void mouseMoved(MouseEvent evt)
\r
476 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
486 for (int i = 0; i < aa.length; i++)
\r
490 height += aa[i].height;
\r
493 if (evt.getY() < height)
\r
501 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
503 if(av.hasHiddenColumns)
\r
504 res = av.getColumnSelection().adjustForHiddenColumns(res);
\r
506 if (row > -1 && res<aa[row].annotations.length)
\r
508 if(aa[row].graphGroup>-1)
\r
510 StringBuffer tip = new StringBuffer("<html>");
\r
511 for (int gg = 0; gg < aa.length; gg++)
\r
513 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res]!=null)
\r
514 tip.append(aa[gg].label+" "+aa[gg].annotations[res].description+"<br>" );
\r
516 if(tip.length()!=6)
\r
518 tip.setLength(tip.length() - 4);
\r
519 this.setToolTipText(tip.toString() + "</html>");
\r
522 else if(aa[row].annotations[res] != null)
\r
523 this.setToolTipText(aa[row].annotations[res].description);
\r
525 if(aa[row].annotations[res]!=null)
\r
527 StringBuffer text = new StringBuffer("Sequence position " +
\r
529 aa[row].annotations[res].description);
\r
531 ap.alignFrame.statusBar.setText(text.toString());
\r
539 * @param evt DOCUMENT ME!
\r
541 public void mouseClicked(MouseEvent evt)
\r
548 * @param g DOCUMENT ME!
\r
550 public void paintComponent(Graphics g)
\r
552 g.setColor(Color.white);
\r
553 g.fillRect(0, 0, getWidth(), getHeight());
\r
557 || (getVisibleRect().width != g.getClipBounds().width)
\r
558 || (getVisibleRect().height != g.getClipBounds().height))
\r
560 g.drawImage(image, 0, 0, this);
\r
565 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
\r
567 if (image == null || imgWidth != image.getWidth()
\r
568 || image.getHeight(this) != getHeight())
\r
570 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
\r
571 BufferedImage.TYPE_INT_RGB);
\r
572 gg = (Graphics2D) image.getGraphics();
\r
575 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
\r
576 RenderingHints.VALUE_ANTIALIAS_ON);
\r
578 gg.setFont(av.getFont());
\r
579 fm = gg.getFontMetrics();
\r
583 drawComponent(gg, av.startRes, av.endRes + 1);
\r
584 g.drawImage(image, 0, 0, this);
\r
590 * @param horizontal DOCUMENT ME!
\r
592 public void fastPaint(int horizontal)
\r
594 if ((horizontal == 0) || gg==null ||
\r
595 (av.alignment.getAlignmentAnnotation() == null) ||
\r
596 (av.alignment.getAlignmentAnnotation().length < 1))
\r
602 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
\r
604 int sr = av.startRes;
\r
605 int er = av.endRes + 1;
\r
608 if (horizontal > 0) // scrollbar pulled right, image to the left
\r
610 transX = (er - sr - horizontal) * av.charWidth;
\r
611 sr = er - horizontal;
\r
613 else if (horizontal < 0)
\r
615 er = sr - horizontal;
\r
618 gg.translate(transX, 0);
\r
620 drawComponent(gg, sr, er);
\r
622 gg.translate(-transX, 0);
\r
633 * @param g DOCUMENT ME!
\r
634 * @param startRes DOCUMENT ME!
\r
635 * @param endRes DOCUMENT ME!
\r
637 public void drawComponent(Graphics g, int startRes, int endRes)
\r
641 g.setFont(av.getFont());
\r
644 fm = g.getFontMetrics();
\r
646 validCharWidth = fm.charWidth('M') <= av.charWidth;
\r
648 g.setColor(Color.white);
\r
649 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
\r
651 if ( (av.alignment.getAlignmentAnnotation() == null) ||
\r
652 (av.alignment.getAlignmentAnnotation().length < 1))
\r
654 g.setColor(Color.white);
\r
655 g.fillRect(0, 0, getWidth(), getHeight());
\r
656 g.setColor(Color.black);
\r
658 g.drawString("Alignment has no annotations", 20, 15);
\r
663 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
669 int iconOffset = av.charHeight / 2;
\r
670 boolean validRes = false;
\r
672 boolean [] graphGroupDrawn = new boolean[aa.length];
\r
676 for (int i = 0; i < aa.length; i++)
\r
678 AlignmentAnnotation row = aa[i];
\r
691 if(row.graphGroup>-1 && graphGroupDrawn[ row.graphGroup ] )
\r
694 // this is so that we draw the characters below the graph
\r
699 y -= av.charHeight;
\r
705 iconOffset = av.charHeight / 2;
\r
712 int column = startRes;
\r
714 while (column < endRes)
\r
716 if (av.hasHiddenColumns)
\r
718 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
719 if (column > row.annotations.length-1)
\r
725 if ((row.annotations.length <= column) ||
\r
726 (row.annotations[column] == null))
\r
735 x = (column - startRes) * av.charWidth;
\r
737 if (activeRow == i)
\r
739 g.setColor(Color.red);
\r
741 if (av.getColumnSelection() != null)
\r
743 for (int n = 0; n < av.getColumnSelection().size(); n++)
\r
745 int v = av.getColumnSelection().columnAt(n);
\r
749 g.fillRect((column - startRes) * av.charWidth, y,
\r
750 av.charWidth, row.height);
\r
756 if (validCharWidth && validRes &&
\r
757 (row.annotations[column].displayCharacter.length() > 0))
\r
760 int charOffset = (av.charWidth -
\r
761 fm.charWidth(row.annotations[column].displayCharacter.charAt(
\r
763 g.setColor(row.annotations[column].colour);
\r
765 if (column == 0 || row.graph>0)
\r
767 g.drawString(row.annotations[column].displayCharacter, x+charOffset,
\r
768 y + iconOffset + 3);
\r
771 row.annotations[column - 1] == null
\r
772 ||(!row.annotations[column].displayCharacter.equals(
\r
773 row.annotations[column - 1].displayCharacter)
\r
775 (row.annotations[column].displayCharacter.length() <2 &&
\r
776 row.annotations[column].secondaryStructure==' ')))
\r
778 g.drawString(row.annotations[column].displayCharacter, x+charOffset,
\r
779 y + iconOffset + 3);
\r
786 (row.annotations[column].secondaryStructure != lastSS))
\r
791 g.setColor(HELIX_COLOUR);
\r
792 int sCol = (lastSSX / av.charWidth) + startRes;
\r
796 if(row.annotations[sCol-1]==null ||
\r
797 row.annotations[sCol-1].secondaryStructure!='H')
\r
799 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
800 x1 += av.charWidth/2;
\r
803 if(row.annotations[column]==null ||
\r
804 row.annotations[column].secondaryStructure!='H')
\r
806 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);
\r
807 x2 -= av.charWidth/2;
\r
810 g.fillRect(x1, y+4+iconOffset, x2-x1, 8);
\r
814 g.setColor(SHEET_COLOUR);
\r
815 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
816 x - lastSSX - 4, 7);
\r
817 g.fillPolygon(new int[] { x - 4, x - 4, x },
\r
820 y + iconOffset, y + 14 + iconOffset,
\r
828 g.setColor(Color.gray);
\r
829 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
837 lastSS = row.annotations[column].secondaryStructure;
\r
858 g.setColor(HELIX_COLOUR);
\r
860 int sCol = (lastSSX / av.charWidth) + startRes;
\r
864 if(row.annotations[sCol-1]==null ||
\r
865 row.annotations[sCol-1].secondaryStructure!='H')
\r
867 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
868 x1 += av.charWidth/2;
\r
871 if(row.annotations[column]==null ||
\r
872 row.annotations[column].secondaryStructure!='H')
\r
874 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);
\r
875 x2 -= av.charWidth/2;
\r
878 g.fillRect(x1, y+4+iconOffset, x2-x1, 8);
\r
883 g.setColor(SHEET_COLOUR);
\r
885 if (row.annotations[endRes] !=null
\r
886 && row.annotations[endRes].secondaryStructure != 'E')
\r
888 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
889 x - lastSSX - 4, 7);
\r
890 g.fillPolygon(new int[]
\r
894 y + iconOffset, y + 14 + iconOffset,
\r
899 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
906 g.setColor(Color.ORANGE);
\r
907 if(!av.wrapAlignment || endRes==av.endRes)
\r
908 g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2);
\r
916 if(row.graph == AlignmentAnnotation.LINE_GRAPH )
\r
918 if(row.graphGroup>-1 && !graphGroupDrawn[row.graphGroup])
\r
920 float groupmax=-999999, groupmin=9999999;
\r
921 for(int gg=0; gg<aa.length; gg++)
\r
923 if(aa[gg].graphGroup!=row.graphGroup)
\r
927 aa[gg].visible = false;
\r
929 if(aa[gg].graphMax>groupmax)
\r
930 groupmax = aa[gg].graphMax;
\r
931 if(aa[gg].graphMin<groupmin)
\r
932 groupmin = aa[gg].graphMin;
\r
935 for (int gg = 0; gg < aa.length; gg++)
\r
937 if (aa[gg].graphGroup == row.graphGroup)
\r
939 drawLineGraph(g, aa[gg], startRes, endRes, y,
\r
940 groupmin, groupmax,
\r
945 graphGroupDrawn[ row.graphGroup ] = true;
\r
948 drawLineGraph(g, row, startRes, endRes,
\r
949 y, row.graphMin, row.graphMax, row.graphHeight );
\r
951 else if(row.graph == AlignmentAnnotation.BAR_GRAPH )
\r
952 drawBarGraph(g, row, startRes, endRes,
\r
953 row.graphMin, row.graphMax, y);
\r
956 if (row.graph>0 && row.hasText)
\r
958 y += av.charHeight;
\r
968 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
\r
969 int sRes, int eRes,
\r
971 float min, float max,
\r
974 if(sRes>aa.annotations.length)
\r
977 eRes = Math.min(eRes, aa.annotations.length);
\r
981 //Adjustment for fastpaint to left
\r
992 float range = max - min;
\r
996 y2 = (int)(y - (0-min / range)*graphHeight);
\r
998 g.setColor(Color.gray);
\r
999 g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);
\r
1001 eRes = Math.min(eRes, aa.annotations.length);
\r
1003 int column = sRes;
\r
1004 int aaMax = aa.annotations.length-1;
\r
1006 while( column < eRes )
\r
1008 if(av.hasHiddenColumns)
\r
1010 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1011 if(column > aaMax)
\r
1017 if(aa.annotations[column]==null || aa.annotations[column-1]==null)
\r
1024 g.setColor(aa.annotations[column].colour);
\r
1025 y1 = y - (int) (((aa.annotations[column-1].value-min) / range) * graphHeight);
\r
1026 y2 = y - (int) (((aa.annotations[column].value-min) / range) * graphHeight);
\r
1027 g.drawLine(x-av.charWidth/2, y1, x+av.charWidth/2, y2);
\r
1028 x += av.charWidth;
\r
1033 if(aa.threshold!=null)
\r
1035 g.setColor(aa.threshold.colour);
\r
1036 Graphics2D g2 = (Graphics2D)g;
\r
1037 g2.setStroke(new BasicStroke(1,
\r
1038 BasicStroke.CAP_SQUARE,
\r
1039 BasicStroke.JOIN_ROUND, 3f,
\r
1040 new float[] { 5f, 3f }, 0f));
\r
1042 y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);
\r
1043 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1044 g2.setStroke(new BasicStroke());
\r
1048 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
\r
1049 int sRes, int eRes,
\r
1050 float min, float max,
\r
1053 if(sRes>aa.annotations.length)
\r
1056 eRes = Math.min(eRes, aa.annotations.length);
\r
1060 float range = max - min;
\r
1065 y2 = (int)(y - (0-min / (range))*aa.graphHeight);
\r
1067 g.setColor(Color.gray);
\r
1069 g.drawLine(x,y2,(eRes-sRes)*av.charWidth,y2);
\r
1072 int column = sRes;
\r
1073 int aaMax = aa.annotations.length-1;
\r
1075 while( column < eRes )
\r
1077 if(av.hasHiddenColumns)
\r
1079 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1080 if(column > aaMax)
\r
1086 if (aa.annotations[column] == null)
\r
1088 x += av.charWidth;
\r
1093 g.setColor(aa.annotations[column].colour);
\r
1094 y1 = y - (int) (((aa.annotations[column].value-min) / (range)) * aa.graphHeight);
\r
1097 g.fillRect(x, y2, av.charWidth, y1-y2 );
\r
1099 g.fillRect(x, y1, av.charWidth, y2-y1 );
\r
1101 x += av.charWidth;
\r
1105 if(aa.threshold!=null)
\r
1107 g.setColor(aa.threshold.colour);
\r
1108 Graphics2D g2 = (Graphics2D)g;
\r
1109 g2.setStroke(new BasicStroke(1,
\r
1110 BasicStroke.CAP_SQUARE,
\r
1111 BasicStroke.JOIN_ROUND, 3f,
\r
1112 new float[] { 5f, 3f }, 0f));
\r
1114 y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);
\r
1115 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1116 g2.setStroke(new BasicStroke());
\r
1120 // used by overview window
\r
1121 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)
\r
1123 g.setColor(Color.white);
\r
1124 g.fillRect(0, 0, width, y);
\r
1125 g.setColor(new Color(0, 0, 180));
\r
1127 int x = 0, height;
\r
1129 for (int j = sRes; j < eRes; j++)
\r
1131 g.setColor(aa.annotations[j].colour);
\r
1133 height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
\r
1137 g.fillRect(x, y - height, av.charWidth, height);
\r
1138 x += av.charWidth;
\r