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
55 boolean fastPaint = false;
\r
57 //Used For mouse Dragging and resizing graphs
\r
58 int graphStretch = -1;
\r
59 int graphStretchY = -1;
\r
60 int min; //used by mouseDragged to see if user
\r
61 int max; //used by mouseDragged to see if user
\r
62 boolean mouseDragging = false;
\r
65 * Creates a new AnnotationPanel object.
\r
67 * @param ap DOCUMENT ME!
\r
69 public AnnotationPanel(AlignmentPanel ap)
\r
71 ToolTipManager.sharedInstance().registerComponent(this);
\r
72 ToolTipManager.sharedInstance().setInitialDelay(0);
\r
73 ToolTipManager.sharedInstance().setDismissDelay(10000);
\r
76 this.setLayout(null);
\r
77 addMouseListener(this);
\r
78 addMouseMotionListener(this);
\r
79 ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);
\r
82 public AnnotationPanel(AlignViewport av)
\r
91 * @param evt DOCUMENT ME!
\r
93 public void adjustmentValueChanged(AdjustmentEvent evt)
\r
95 ap.alabels.setScrollOffset(-evt.getValue());
\r
101 public int adjustPanelHeight()
\r
103 // setHeight of panels
\r
105 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
110 for (int i = 0; i < aa.length; i++)
\r
112 if (!aa[i].visible)
\r
121 aa[i].height += av.charHeight;
\r
124 if (aa[i].hasIcons)
\r
126 aa[i].height += 16;
\r
131 aa[i].height += aa[i].graphHeight;
\r
134 if (aa[i].height == 0)
\r
139 height += aa[i].height;
\r
147 this.setPreferredSize(new Dimension(1, height));
\r
157 * @param evt DOCUMENT ME!
\r
159 public void actionPerformed(ActionEvent evt)
\r
161 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
162 Annotation[] anot = aa[activeRow].annotations;
\r
164 if (evt.getActionCommand().equals(REMOVE))
\r
166 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
168 anot[av.getColumnSelection().columnAt(i)] = null;
\r
171 else if (evt.getActionCommand().equals(LABEL))
\r
173 String label = JOptionPane.showInputDialog(this, "Enter Label ",
\r
174 "Enter label", JOptionPane.QUESTION_MESSAGE);
\r
181 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
183 aa[activeRow].hasText = true;
\r
186 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
188 int index = av.getColumnSelection().columnAt(i);
\r
190 if (anot[index] == null)
\r
192 anot[index] = new Annotation(label, "", ' ', 0);
\r
195 anot[index].displayCharacter = label;
\r
198 else if (evt.getActionCommand().equals(COLOUR))
\r
200 Color col = JColorChooser.showDialog(this,
\r
201 "Choose foreground colour", Color.black);
\r
203 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
205 int index = av.getColumnSelection().columnAt(i);
\r
207 if (anot[index] == null)
\r
209 anot[index] = new Annotation("", "", ' ', 0);
\r
212 anot[index].colour = col;
\r
215 else // HELIX OR SHEET
\r
218 String symbol = "\u03B1";
\r
220 if (evt.getActionCommand().equals(HELIX))
\r
224 else if (evt.getActionCommand().equals(SHEET))
\r
230 if (!aa[activeRow].hasIcons)
\r
232 aa[activeRow].hasIcons = true;
\r
235 String label = JOptionPane.showInputDialog("Enter a label for the structure?",
\r
243 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
245 aa[activeRow].hasText = true;
\r
248 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
250 int index = av.getColumnSelection().columnAt(i);
\r
252 if (anot[index] == null)
\r
254 anot[index] = new Annotation(label, "", type, 0);
\r
257 anot[index].secondaryStructure = type;
\r
258 anot[index].displayCharacter = label;
\r
262 adjustPanelHeight();
\r
271 * @param evt DOCUMENT ME!
\r
273 public void mousePressed(MouseEvent evt)
\r
278 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
282 for (int i = 0; i < aa.length; i++)
\r
286 height += aa[i].height;
\r
289 if (evt.getY() < height)
\r
291 if (aa[i].editable)
\r
295 else if(aa[i].graph>0)
\r
299 graphStretchY = evt.getY();
\r
306 if (SwingUtilities.isRightMouseButton(evt))
\r
308 if (av.getColumnSelection() == null)
\r
313 JPopupMenu pop = new JPopupMenu("Structure type");
\r
314 JMenuItem item = new JMenuItem(HELIX);
\r
315 item.addActionListener(this);
\r
317 item = new JMenuItem(SHEET);
\r
318 item.addActionListener(this);
\r
320 item = new JMenuItem(LABEL);
\r
321 item.addActionListener(this);
\r
323 item = new JMenuItem(COLOUR);
\r
324 item.addActionListener(this);
\r
326 item = new JMenuItem(REMOVE);
\r
327 item.addActionListener(this);
\r
329 pop.show(this, evt.getX(), evt.getY());
\r
339 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
344 if (av.getColumnSelection().contains(res))
\r
345 av.getColumnSelection().removeElement(res);
\r
348 av.getColumnSelection().addElement(res);
\r
349 SequenceGroup sg = new SequenceGroup();
\r
351 for (int i = 0; i < av.alignment.getSequences().size(); i++)
\r
353 sg.addSequence(av.alignment.getSequenceAt(i), false);
\r
356 sg.setStartRes(res);
\r
358 av.setSelectionGroup(sg);
\r
368 * @param evt DOCUMENT ME!
\r
370 public void mouseReleased(MouseEvent evt)
\r
373 graphStretchY = -1;
\r
374 mouseDragging = false;
\r
380 * @param evt DOCUMENT ME!
\r
382 public void mouseEntered(MouseEvent evt)
\r
385 ap.seqPanel.scrollCanvas(null);
\r
391 * @param evt DOCUMENT ME!
\r
393 public void mouseExited(MouseEvent evt)
\r
396 ap.seqPanel.scrollCanvas(evt);
\r
403 * @param evt DOCUMENT ME!
\r
405 public void mouseDragged(MouseEvent evt)
\r
407 if(graphStretch>-1)
\r
409 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - evt.getY();
\r
410 if(av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight <10)
\r
411 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 10;
\r
412 graphStretchY = evt.getY();
\r
413 adjustPanelHeight();
\r
418 mouseDragging = true;
\r
420 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
422 SequenceGroup sg = av.getSelectionGroup();
\r
436 if (!av.getColumnSelection().contains(res))
\r
438 av.getColumnSelection().addElement(res);
\r
441 if (res > sg.getStartRes())
\r
445 else if (res < sg.getStartRes())
\r
447 sg.setStartRes(res);
\r
450 for (int i = min; i <= max; i++)
\r
452 if ((i < sg.getStartRes()) || (i > sg.getEndRes()))
\r
454 av.getColumnSelection().removeElement(i);
\r
458 av.getColumnSelection().addElement(i);
\r
471 * @param evt DOCUMENT ME!
\r
473 public void mouseMoved(MouseEvent evt)
\r
475 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
485 for (int i = 0; i < aa.length; i++)
\r
489 height += aa[i].height;
\r
492 if (evt.getY() < height)
\r
500 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
502 if(av.hasHiddenColumns)
\r
503 res = av.getColumnSelection().adjustForHiddenColumns(res);
\r
505 if (row > -1 && res<aa[row].annotations.length)
\r
507 if(aa[row].graphGroup>-1)
\r
509 StringBuffer tip = new StringBuffer("<html>");
\r
510 for (int gg = 0; gg < aa.length; gg++)
\r
512 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res]!=null)
\r
513 tip.append(aa[gg].label+" "+aa[gg].annotations[res].description+"<br>" );
\r
515 if(tip.length()!=6)
\r
517 tip.setLength(tip.length() - 4);
\r
518 this.setToolTipText(tip.toString() + "</html>");
\r
521 else if(aa[row].annotations[res] != null)
\r
522 this.setToolTipText(aa[row].annotations[res].description);
\r
524 if(aa[row].annotations[res]!=null)
\r
526 StringBuffer text = new StringBuffer("Sequence position " +
\r
528 aa[row].annotations[res].description);
\r
530 ap.alignFrame.statusBar.setText(text.toString());
\r
538 * @param evt DOCUMENT ME!
\r
540 public void mouseClicked(MouseEvent evt)
\r
547 * @param g DOCUMENT ME!
\r
549 public void paintComponent(Graphics g)
\r
553 || (getVisibleRect().width != g.getClipBounds().width)
\r
554 || (getVisibleRect().height != g.getClipBounds().height))
\r
556 g.drawImage(image, 0, 0, this);
\r
561 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
\r
563 if (image == null || imgWidth != image.getWidth()
\r
564 || image.getHeight(this) != getHeight())
\r
566 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
\r
567 BufferedImage.TYPE_INT_RGB);
\r
568 gg = (Graphics2D) image.getGraphics();
\r
571 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
\r
572 RenderingHints.VALUE_ANTIALIAS_ON);
\r
574 gg.setFont(av.getFont());
\r
575 fm = gg.getFontMetrics();
\r
579 drawComponent(gg, av.startRes, av.endRes + 1);
\r
580 g.drawImage(image, 0, 0, this);
\r
586 * @param horizontal DOCUMENT ME!
\r
588 public void fastPaint(int horizontal)
\r
590 if ((horizontal == 0) || gg==null ||
\r
591 (av.alignment.getAlignmentAnnotation() == null) ||
\r
592 (av.alignment.getAlignmentAnnotation().length < 1))
\r
598 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
\r
600 int sr = av.startRes;
\r
601 int er = av.endRes + 1;
\r
604 if (horizontal > 0) // scrollbar pulled right, image to the left
\r
606 transX = (er - sr - horizontal) * av.charWidth;
\r
607 sr = er - horizontal;
\r
609 else if (horizontal < 0)
\r
611 er = sr - horizontal;
\r
614 gg.translate(transX, 0);
\r
616 drawComponent(gg, sr, er);
\r
618 gg.translate(-transX, 0);
\r
629 * @param g DOCUMENT ME!
\r
630 * @param startRes DOCUMENT ME!
\r
631 * @param endRes DOCUMENT ME!
\r
633 public void drawComponent(Graphics g, int startRes, int endRes)
\r
637 g.setFont(av.getFont());
\r
640 fm = g.getFontMetrics();
\r
643 g.setColor(Color.white);
\r
644 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
\r
646 if ( (av.alignment.getAlignmentAnnotation() == null) ||
\r
647 (av.alignment.getAlignmentAnnotation().length < 1))
\r
649 g.setColor(Color.white);
\r
650 g.fillRect(0, 0, getWidth(), getHeight());
\r
651 g.setColor(Color.black);
\r
652 if(av.validCharWidth)
\r
653 g.drawString("Alignment has no annotations", 20, 15);
\r
658 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
664 int iconOffset = av.charHeight / 2;
\r
665 boolean validRes = false;
\r
667 boolean [] graphGroupDrawn = new boolean[aa.length];
\r
671 for (int i = 0; i < aa.length; i++)
\r
673 AlignmentAnnotation row = aa[i];
\r
686 if(row.graphGroup>-1 && graphGroupDrawn[ row.graphGroup ] )
\r
689 // this is so that we draw the characters below the graph
\r
694 y -= av.charHeight;
\r
700 iconOffset = av.charHeight / 2;
\r
707 int column = startRes;
\r
709 while (column < endRes)
\r
711 if (av.hasHiddenColumns)
\r
713 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
714 if (column > row.annotations.length-1)
\r
720 if ((row.annotations.length <= column) ||
\r
721 (row.annotations[column] == null))
\r
730 x = (column - startRes) * av.charWidth;
\r
732 if (activeRow == i)
\r
734 g.setColor(Color.red);
\r
736 if (av.getColumnSelection() != null)
\r
738 for (int n = 0; n < av.getColumnSelection().size(); n++)
\r
740 int v = av.getColumnSelection().columnAt(n);
\r
744 g.fillRect((column - startRes) * av.charWidth, y,
\r
745 av.charWidth, row.height);
\r
751 if (av.validCharWidth && validRes &&
\r
752 (row.annotations[column].displayCharacter.length() > 0))
\r
755 int charOffset = (av.charWidth -
\r
756 fm.charWidth(row.annotations[column].displayCharacter.charAt(
\r
758 g.setColor(row.annotations[column].colour);
\r
760 if (column == 0 || row.graph>0)
\r
762 g.drawString(row.annotations[column].displayCharacter, x+charOffset,
\r
763 y + iconOffset + 3);
\r
766 row.annotations[column - 1] == null
\r
767 ||(!row.annotations[column].displayCharacter.equals(
\r
768 row.annotations[column - 1].displayCharacter)
\r
770 (row.annotations[column].displayCharacter.length() <2 &&
\r
771 row.annotations[column].secondaryStructure==' ')))
\r
773 g.drawString(row.annotations[column].displayCharacter, x+charOffset,
\r
774 y + iconOffset + 3);
\r
781 (row.annotations[column].secondaryStructure != lastSS))
\r
786 g.setColor(HELIX_COLOUR);
\r
787 int sCol = (lastSSX / av.charWidth) + startRes;
\r
791 if(row.annotations[sCol-1]==null ||
\r
792 row.annotations[sCol-1].secondaryStructure!='H')
\r
794 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
795 x1 += av.charWidth/2;
\r
798 if(row.annotations[column]==null ||
\r
799 row.annotations[column].secondaryStructure!='H')
\r
801 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);
\r
802 x2 -= av.charWidth/2;
\r
805 g.fillRect(x1, y+4+iconOffset, x2-x1, 8);
\r
809 g.setColor(SHEET_COLOUR);
\r
810 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
811 x - lastSSX - 4, 7);
\r
812 g.fillPolygon(new int[] { x - 4, x - 4, x },
\r
815 y + iconOffset, y + 14 + iconOffset,
\r
823 g.setColor(Color.gray);
\r
824 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
832 lastSS = row.annotations[column].secondaryStructure;
\r
853 g.setColor(HELIX_COLOUR);
\r
855 int sCol = (lastSSX / av.charWidth) + startRes;
\r
859 if(row.annotations[sCol-1]==null ||
\r
860 row.annotations[sCol-1].secondaryStructure!='H')
\r
862 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
863 x1 += av.charWidth/2;
\r
866 if(row.annotations[column]==null ||
\r
867 row.annotations[column].secondaryStructure!='H')
\r
869 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);
\r
870 x2 -= av.charWidth/2;
\r
873 g.fillRect(x1, y+4+iconOffset, x2-x1, 8);
\r
878 g.setColor(SHEET_COLOUR);
\r
880 if (row.annotations[endRes] !=null
\r
881 && row.annotations[endRes].secondaryStructure != 'E')
\r
883 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
884 x - lastSSX - 4, 7);
\r
885 g.fillPolygon(new int[]
\r
889 y + iconOffset, y + 14 + iconOffset,
\r
894 g.setColor(Color.gray);
\r
895 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
902 g.setColor(Color.ORANGE);
\r
903 if(!av.wrapAlignment || endRes==av.endRes)
\r
904 g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2);
\r
912 if(row.graph == AlignmentAnnotation.LINE_GRAPH )
\r
914 if(row.graphGroup>-1 && !graphGroupDrawn[row.graphGroup])
\r
916 float groupmax=-999999, groupmin=9999999;
\r
917 for(int gg=0; gg<aa.length; gg++)
\r
919 if(aa[gg].graphGroup!=row.graphGroup)
\r
923 aa[gg].visible = false;
\r
925 if(aa[gg].graphMax>groupmax)
\r
926 groupmax = aa[gg].graphMax;
\r
927 if(aa[gg].graphMin<groupmin)
\r
928 groupmin = aa[gg].graphMin;
\r
931 for (int gg = 0; gg < aa.length; gg++)
\r
933 if (aa[gg].graphGroup == row.graphGroup)
\r
935 drawLineGraph(g, aa[gg], startRes, endRes, y,
\r
936 groupmin, groupmax,
\r
941 graphGroupDrawn[ row.graphGroup ] = true;
\r
944 drawLineGraph(g, row, startRes, endRes,
\r
945 y, row.graphMin, row.graphMax, row.graphHeight );
\r
947 else if(row.graph == AlignmentAnnotation.BAR_GRAPH )
\r
948 drawBarGraph(g, row, startRes, endRes,
\r
949 row.graphMin, row.graphMax, y);
\r
952 if (row.graph>0 && row.hasText)
\r
954 y += av.charHeight;
\r
964 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
\r
965 int sRes, int eRes,
\r
967 float min, float max,
\r
970 if(sRes>aa.annotations.length)
\r
973 eRes = Math.min(eRes, aa.annotations.length);
\r
977 //Adjustment for fastpaint to left
\r
988 float range = max - min;
\r
992 y2 = (int)(y - (0-min / range)*graphHeight);
\r
994 g.setColor(Color.gray);
\r
995 g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);
\r
997 eRes = Math.min(eRes, aa.annotations.length);
\r
1000 int aaMax = aa.annotations.length-1;
\r
1002 while( column < eRes )
\r
1004 if(av.hasHiddenColumns)
\r
1006 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1007 if(column > aaMax)
\r
1013 if(aa.annotations[column]==null || aa.annotations[column-1]==null)
\r
1020 g.setColor(aa.annotations[column].colour);
\r
1021 y1 = y - (int) (((aa.annotations[column-1].value-min) / range) * graphHeight);
\r
1022 y2 = y - (int) (((aa.annotations[column].value-min) / range) * graphHeight);
\r
1023 g.drawLine(x-av.charWidth/2, y1, x+av.charWidth/2, y2);
\r
1024 x += av.charWidth;
\r
1029 if(aa.threshold!=null)
\r
1031 g.setColor(aa.threshold.colour);
\r
1032 Graphics2D g2 = (Graphics2D)g;
\r
1033 g2.setStroke(new BasicStroke(1,
\r
1034 BasicStroke.CAP_SQUARE,
\r
1035 BasicStroke.JOIN_ROUND, 3f,
\r
1036 new float[] { 5f, 3f }, 0f));
\r
1038 y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);
\r
1039 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1040 g2.setStroke(new BasicStroke());
\r
1044 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
\r
1045 int sRes, int eRes,
\r
1046 float min, float max,
\r
1049 if(sRes>aa.annotations.length)
\r
1052 eRes = Math.min(eRes, aa.annotations.length);
\r
1056 float range = max - min;
\r
1061 y2 = (int)(y - (0-min / (range))*aa.graphHeight);
\r
1063 g.setColor(Color.gray);
\r
1065 g.drawLine(x,y2,(eRes-sRes)*av.charWidth,y2);
\r
1068 int column = sRes;
\r
1069 int aaMax = aa.annotations.length-1;
\r
1071 while( column < eRes )
\r
1073 if(av.hasHiddenColumns)
\r
1075 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1076 if(column > aaMax)
\r
1082 if (aa.annotations[column] == null)
\r
1084 x += av.charWidth;
\r
1089 g.setColor(aa.annotations[column].colour);
\r
1090 y1 = y - (int) (((aa.annotations[column].value-min) / (range)) * aa.graphHeight);
\r
1093 g.fillRect(x, y2, av.charWidth, y1-y2 );
\r
1095 g.fillRect(x, y1, av.charWidth, y2-y1 );
\r
1097 x += av.charWidth;
\r
1101 if(aa.threshold!=null)
\r
1103 g.setColor(aa.threshold.colour);
\r
1104 Graphics2D g2 = (Graphics2D)g;
\r
1105 g2.setStroke(new BasicStroke(1,
\r
1106 BasicStroke.CAP_SQUARE,
\r
1107 BasicStroke.JOIN_ROUND, 3f,
\r
1108 new float[] { 5f, 3f }, 0f));
\r
1110 y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);
\r
1111 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1112 g2.setStroke(new BasicStroke());
\r
1116 // used by overview window
\r
1117 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)
\r
1119 g.setColor(Color.white);
\r
1120 g.fillRect(0, 0, width, y);
\r
1121 g.setColor(new Color(0, 0, 180));
\r
1123 int x = 0, height;
\r
1125 for (int j = sRes; j < eRes; j++)
\r
1127 g.setColor(aa.annotations[j].colour);
\r
1129 height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
\r
1133 g.fillRect(x, y - height, av.charWidth, height);
\r
1134 x += av.charWidth;
\r