2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.datamodel.AlignmentI;
24 import jalview.datamodel.HiddenColumns;
25 import jalview.datamodel.SearchResultsI;
26 import jalview.datamodel.SequenceGroup;
27 import jalview.datamodel.SequenceI;
28 import jalview.renderer.ScaleRenderer;
29 import jalview.renderer.ScaleRenderer.ScaleMark;
30 import jalview.viewmodel.ViewportListenerI;
31 import jalview.viewmodel.ViewportRanges;
33 import java.awt.AlphaComposite;
34 import java.awt.BasicStroke;
35 import java.awt.BorderLayout;
36 import java.awt.Color;
37 import java.awt.FontMetrics;
38 import java.awt.Graphics;
39 import java.awt.Graphics2D;
40 import java.awt.RenderingHints;
41 import java.awt.Shape;
42 import java.awt.image.BufferedImage;
43 import java.beans.PropertyChangeEvent;
44 import java.util.List;
46 import javax.swing.JComponent;
54 public class SeqCanvas extends JComponent implements ViewportListenerI
56 final FeatureRenderer fr;
58 final SequenceRenderer sr;
70 boolean fastPaint = false;
81 * Creates a new SeqCanvas object.
86 public SeqCanvas(AlignmentPanel ap)
90 fr = new FeatureRenderer(ap);
91 sr = new SequenceRenderer(av);
92 setLayout(new BorderLayout());
93 PaintRefresher.Register(this, av.getSequenceSetId());
94 setBackground(Color.white);
96 av.getRanges().addPropertyChangeListener(this);
99 public SequenceRenderer getSequenceRenderer()
104 public FeatureRenderer getFeatureRenderer()
109 int charHeight = 0, charWidth = 0;
111 private void updateViewport()
113 charHeight = av.getCharHeight();
114 charWidth = av.getCharWidth();
129 private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
132 for (ScaleMark mark : new ScaleRenderer().calculateMarks(av, startx,
135 int mpos = mark.column; // (i - startx - 1)
140 String mstring = mark.text;
146 g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2));
148 g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2)
149 - (charHeight / 2), (mpos * charWidth) + (charWidth / 2),
167 void drawWestScale(Graphics g, int startx, int endx, int ypos)
169 FontMetrics fm = getFontMetrics(av.getFont());
172 if (av.hasHiddenColumns())
174 startx = av.getAlignment().getHiddenColumns()
175 .adjustForHiddenColumns(startx);
176 endx = av.getAlignment().getHiddenColumns()
177 .adjustForHiddenColumns(endx);
180 int maxwidth = av.getAlignment().getWidth();
181 if (av.hasHiddenColumns())
183 maxwidth = av.getAlignment().getHiddenColumns()
184 .findColumnPosition(maxwidth) - 1;
188 for (int i = 0; i < av.getAlignment().getHeight(); i++)
190 SequenceI seq = av.getAlignment().getSequenceAt(i);
196 if (jalview.util.Comparison.isGap(seq.getCharAt(index)))
203 value = av.getAlignment().getSequenceAt(i).findPosition(index);
210 int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
212 g.drawString(value + "", x, (ypos + (i * charHeight))
230 void drawEastScale(Graphics g, int startx, int endx, int ypos)
234 if (av.hasHiddenColumns())
236 endx = av.getAlignment().getHiddenColumns()
237 .adjustForHiddenColumns(endx);
242 for (int i = 0; i < av.getAlignment().getHeight(); i++)
244 seq = av.getAlignment().getSequenceAt(i);
248 while (index > startx)
250 if (jalview.util.Comparison.isGap(seq.getCharAt(index)))
257 value = seq.findPosition(index);
264 g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight))
270 boolean fastpainting = false;
273 * need to make this thread safe move alignment rendering in response to
279 * shift up or down in repaint
281 public void fastPaint(int horizontal, int vertical)
283 if (fastpainting || gg == null)
291 ViewportRanges ranges = av.getRanges();
292 int sr = ranges.getStartRes();
293 int er = ranges.getEndRes();
294 int ss = ranges.getStartSeq();
295 int es = ranges.getEndSeq();
299 gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth,
300 imgHeight, -horizontal * charWidth, -vertical * charHeight);
302 if (horizontal > 0) // scrollbar pulled right, image to the left
304 transX = (er - sr - horizontal) * charWidth;
305 sr = er - horizontal;
307 else if (horizontal < 0)
309 er = sr - horizontal;
311 else if (vertical > 0) // scroll down
315 if (ss < ranges.getStartSeq())
316 { // ie scrolling too fast, more than a page at a time
317 ss = ranges.getStartSeq();
321 transY = imgHeight - ((vertical + 1) * charHeight);
324 else if (vertical < 0)
328 if (es > ranges.getEndSeq())
330 es = ranges.getEndSeq();
334 gg.translate(transX, transY);
335 drawPanel(gg, sr, er, ss, es, 0);
336 gg.translate(-transX, -transY);
339 fastpainting = false;
343 * Definitions of startx and endx (hopefully): SMJS This is what I'm working
344 * towards! startx is the first residue (starting at 0) to display. endx is
345 * the last residue to display (starting at 0). starty is the first sequence
346 * to display (starting at 0). endy is the last sequence to display (starting
347 * at 0). NOTE 1: The av limits are set in setFont in this class and in the
348 * adjustment listener in SeqPanel when the scrollbars move.
351 // Set this to false to force a full panel paint
353 public void paintComponent(Graphics g)
356 BufferedImage lcimg = img; // take reference since other threads may null
357 // img and call later.
358 super.paintComponent(g);
360 BufferedImage selectImage = drawSelectionGroup();
364 || (getVisibleRect().width != g.getClipBounds().width) || (getVisibleRect().height != g
365 .getClipBounds().height)))
367 Graphics2D g2 = (Graphics2D) lcimg.getGraphics();
368 g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
369 // g.drawImage(lcimg, 0, 0, this);
371 // overlay selection group on lcimg
372 if (selectImage != null)
375 AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
376 g2.drawImage(selectImage, 0, 0, this);
378 g.drawImage(lcimg, 0, 0, this);
384 lcimg = setupImage(lcimg);
393 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
394 RenderingHints.VALUE_ANTIALIAS_ON);
397 gg.setColor(Color.white);
398 gg.fillRect(0, 0, imgWidth, imgHeight);
400 ViewportRanges ranges = av.getRanges();
401 if (av.getWrapAlignment())
403 drawWrappedPanel(gg, getWidth(), getHeight(), ranges.getStartRes());
407 drawPanel(gg, ranges.getStartRes(), ranges.getEndRes(),
408 ranges.getStartSeq(), ranges.getEndSeq(), 0);
411 Graphics2D g2 = (Graphics2D) lcimg.getGraphics();
412 // g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
413 // g.drawImage(lcimg, 0, 0, this); // scrolling only works with g not g2???
415 // overlay selection group on lcimg
416 if (selectImage != null)
419 AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
420 g2.drawImage(selectImage, 0, 0, this);
422 g.drawImage(lcimg, 0, 0, this);
423 // g.drawImage(selectImage, 0, 0, this);
426 private BufferedImage setupImage(BufferedImage lcimg)
428 // this draws the whole of the alignment
429 imgWidth = getWidth();
430 imgHeight = getHeight();
432 imgWidth -= (imgWidth % charWidth);
433 imgHeight -= (imgHeight % charHeight);
435 if ((imgWidth < 1) || (imgHeight < 1))
440 if (lcimg == null || imgWidth != lcimg.getWidth()
441 || imgHeight != lcimg.getHeight())
445 lcimg = img = new BufferedImage(imgWidth, imgHeight,
446 BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
447 gg = (Graphics2D) img.getGraphics();
448 gg.setFont(av.getFont());
449 } catch (OutOfMemoryError er)
452 System.err.println("SeqCanvas OutOfMemory Redraw Error.\n" + er);
453 new OOMWarning("Creating alignment image for display", er);
461 private BufferedImage setupSelectionImage()
463 BufferedImage lcimg = null;
465 int width = getWidth();
466 int height = getHeight();
468 width -= (width % charWidth);
469 height -= (height % charHeight);
471 if ((width < 1) || (height < 1))
478 lcimg = new BufferedImage(imgWidth, imgHeight,
479 BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
480 } catch (OutOfMemoryError er)
484 "Selection Group image OutOfMemory Redraw Error.\n" + er);
485 new OOMWarning("Creating alignment image for display", er);
499 * @return DOCUMENT ME!
501 public int getWrappedCanvasWidth(int cwidth)
503 FontMetrics fm = getFontMetrics(av.getFont());
508 if (av.getScaleRightWrapped())
510 LABEL_EAST = fm.stringWidth(getMask());
513 if (av.getScaleLeftWrapped())
515 LABEL_WEST = fm.stringWidth(getMask());
518 return (cwidth - LABEL_EAST - LABEL_WEST) / charWidth;
522 * Generates a string of zeroes.
531 for (int i = 0; i < av.getAlignment().getHeight(); i++)
533 tmp = av.getAlignment().getSequenceAt(i).getEnd();
540 for (int i = maxWidth; i > 0; i /= 10)
554 * @param canvasHeight
559 public void drawWrappedPanel(Graphics g, int canvasWidth,
560 int canvasHeight, int startRes)
563 AlignmentI al = av.getAlignment();
565 FontMetrics fm = getFontMetrics(av.getFont());
570 if (av.getScaleRightWrapped())
572 LABEL_EAST = fm.stringWidth(getMask());
575 if (av.getScaleLeftWrapped())
577 LABEL_WEST = fm.stringWidth(getMask());
580 int hgap = charHeight;
581 if (av.getScaleAboveWrapped())
586 int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / charWidth;
587 int cHeight = av.getAlignment().getHeight() * charHeight;
589 av.setWrappedWidth(cWidth);
591 av.getRanges().setViewportStartAndWidth(startRes, cWidth);
595 int maxwidth = av.getAlignment().getWidth();
597 if (av.hasHiddenColumns())
599 maxwidth = av.getAlignment().getHiddenColumns()
600 .findColumnPosition(maxwidth);
603 while ((ypos <= canvasHeight) && (startRes < maxwidth))
605 endx = startRes + cWidth - 1;
612 g.setFont(av.getFont());
613 g.setColor(Color.black);
615 if (av.getScaleLeftWrapped())
617 drawWestScale(g, startRes, endx, ypos);
620 if (av.getScaleRightWrapped())
622 g.translate(canvasWidth - LABEL_EAST, 0);
623 drawEastScale(g, startRes, endx, ypos);
624 g.translate(-(canvasWidth - LABEL_EAST), 0);
627 g.translate(LABEL_WEST, 0);
629 if (av.getScaleAboveWrapped())
631 drawNorthScale(g, startRes, endx, ypos);
634 if (av.hasHiddenColumns() && av.getShowHiddenMarkers())
636 g.setColor(Color.blue);
638 HiddenColumns hidden = av.getAlignment().getHiddenColumns();
639 List<Integer> positions = hidden.findHiddenRegionPositions();
640 for (int pos : positions)
642 res = pos - startRes;
644 if (res < 0 || res > endx - startRes)
650 new int[] { res * charWidth - charHeight / 4,
651 res * charWidth + charHeight / 4, res * charWidth },
652 new int[] { ypos - (charHeight / 2),
653 ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 },
659 // When printing we have an extra clipped region,
660 // the Printable page which we need to account for here
661 Shape clip = g.getClip();
665 g.setClip(0, 0, cWidth * charWidth, canvasHeight);
669 g.setClip(0, (int) clip.getBounds().getY(), cWidth * charWidth,
670 (int) clip.getBounds().getHeight());
673 drawPanel(g, startRes, endx, 0, al.getHeight() - 1, ypos);
675 if (av.isShowAnnotation())
677 g.translate(0, cHeight + ypos + 3);
678 if (annotations == null)
680 annotations = new AnnotationPanel(av);
683 annotations.renderer.drawComponent(annotations, av, g, -1,
685 g.translate(0, -cHeight - ypos - 3);
688 g.translate(-LABEL_WEST, 0);
690 ypos += cHeight + getAnnotationHeight() + hgap;
696 AnnotationPanel annotations;
698 int getAnnotationHeight()
700 if (!av.isShowAnnotation())
705 if (annotations == null)
707 annotations = new AnnotationPanel(av);
710 return annotations.adjustPanelHeight();
729 public void drawPanel(Graphics g1, int startRes, int endRes,
730 int startSeq, int endSeq, int offset)
733 if (!av.hasHiddenColumns())
735 draw(g1, startRes, endRes, startSeq, endSeq, offset);
740 int blockStart = startRes;
741 int blockEnd = endRes;
743 for (int[] region : av.getAlignment().getHiddenColumns()
744 .getHiddenColumnsCopy())
746 int hideStart = region[0];
747 int hideEnd = region[1];
749 if (hideStart <= blockStart)
751 blockStart += (hideEnd - hideStart) + 1;
755 blockEnd = hideStart - 1;
757 g1.translate(screenY * charWidth, 0);
759 draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
761 if (av.getShowHiddenMarkers())
763 g1.setColor(Color.blue);
765 g1.drawLine((blockEnd - blockStart + 1) * charWidth - 1,
766 0 + offset, (blockEnd - blockStart + 1) * charWidth - 1,
767 (endSeq - startSeq + 1) * charHeight + offset);
770 g1.translate(-screenY * charWidth, 0);
771 screenY += blockEnd - blockStart + 1;
772 blockStart = hideEnd + 1;
774 if (screenY > (endRes - startRes))
776 // already rendered last block
781 if (screenY <= (endRes - startRes))
783 // remaining visible region to render
784 blockEnd = blockStart + (endRes - startRes) - screenY;
785 g1.translate(screenY * charWidth, 0);
786 draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
788 g1.translate(-screenY * charWidth, 0);
794 // int startRes, int endRes, int startSeq, int endSeq, int x, int y,
795 // int x1, int x2, int y1, int y2, int startx, int starty,
796 private void draw(Graphics g, int startRes, int endRes, int startSeq,
797 int endSeq, int offset)
799 g.setFont(av.getFont());
800 sr.prepare(g, av.isRenderGaps());
804 // / First draw the sequences
805 // ///////////////////////////
806 for (int i = startSeq; i <= endSeq; i++)
808 nextSeq = av.getAlignment().getSequenceAt(i);
811 // occasionally, a race condition occurs such that the alignment row is
815 sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
816 startRes, endRes, offset + ((i - startSeq) * charHeight));
818 if (av.isShowSequenceFeatures())
820 fr.drawSequence(g, nextSeq, startRes, endRes, offset
821 + ((i - startSeq) * charHeight), false);
824 // / Highlight search Results once all sequences have been drawn
825 // ////////////////////////////////////////////////////////
826 if (av.hasSearchResults())
828 int[] visibleResults = av.getSearchResults().getResults(nextSeq,
830 if (visibleResults != null)
832 for (int r = 0; r < visibleResults.length; r += 2)
834 sr.drawHighlightedText(nextSeq, visibleResults[r],
835 visibleResults[r + 1], (visibleResults[r] - startRes)
837 + ((i - startSeq) * charHeight));
842 if (av.cursorMode && cursorY == i && cursorX >= startRes
843 && cursorX <= endRes)
845 sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * charWidth,
846 offset + ((i - startSeq) * charHeight));
850 if (av.getSelectionGroup() != null
851 || av.getAlignment().getGroups().size() > 0)
853 drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
858 void drawGroupsBoundaries(Graphics g1, int startRes, int endRes,
859 int startSeq, int endSeq, int offset)
861 Graphics2D g = (Graphics2D) g1;
863 // ///////////////////////////////////
864 // Now outline any areas if necessary
865 // ///////////////////////////////////
866 // SequenceGroup group = av.getSelectionGroup();
868 SequenceGroup group = null;
874 int visWidth = (endRes - startRes + 1) * charWidth;
876 // if ((group == null) && (av.getAlignment().getGroups().size() > 0))
877 if (av.getAlignment().getGroups().size() > 0)
879 group = av.getAlignment().getGroups().get(0);
889 boolean inGroup = false;
893 for (i = startSeq; i <= endSeq; i++)
895 // position of start residue of group relative to startRes, in pixels
896 sx = (group.getStartRes() - startRes) * charWidth;
897 sy = offset + ((i - startSeq) * charHeight);
898 // width of group in pixels
899 ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1;
901 if (sx + ex < 0 || sx > visWidth)
906 if ((sx <= (endRes - startRes) * charWidth)
907 && group.getSequences(null).contains(
908 av.getAlignment().getSequenceAt(i)))
911 && !group.getSequences(null).contains(
912 av.getAlignment().getSequenceAt(i + 1)))
914 bottom = sy + charHeight;
919 if (((top == -1) && (i == 0))
920 || !group.getSequences(null).contains(
921 av.getAlignment().getSequenceAt(i - 1)))
929 /*if (group == av.getSelectionGroup())
931 g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,
932 BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f },
934 g.setColor(Color.RED);
938 g.setStroke(new BasicStroke());
939 g.setColor(group.getOutlineColour());
947 // if start position is visible, draw vertical line to left of
949 if (sx >= 0 && sx < visWidth)
951 g.drawLine(sx, oldY, sx, sy);
954 // if end position is visible, draw vertical line to right of
956 if (sx + ex < visWidth)
958 g.drawLine(sx + ex, oldY, sx + ex, sy);
967 if (sx + ex > visWidth)
972 else if (sx + ex >= (endRes - startRes + 1) * charWidth)
974 ex = (endRes - startRes + 1) * charWidth;
977 // draw horizontal line at top of group
980 g.drawLine(sx, top, sx + ex, top);
984 // draw horizontal line at bottom of group
987 g.drawLine(sx, bottom, sx + ex, bottom);
998 sy = offset + ((i - startSeq) * charHeight);
999 if (sx >= 0 && sx < visWidth)
1001 g.drawLine(sx, oldY, sx, sy);
1004 if (sx + ex < visWidth)
1006 g.drawLine(sx + ex, oldY, sx + ex, sy);
1015 if (sx + ex > visWidth)
1019 else if (sx + ex >= (endRes - startRes + 1) * charWidth)
1021 ex = (endRes - startRes + 1) * charWidth;
1026 g.drawLine(sx, top, sx + ex, top);
1032 g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);
1041 g.setStroke(new BasicStroke());
1043 if (groupIndex >= av.getAlignment().getGroups().size())
1048 group = av.getAlignment().getGroups().get(groupIndex);
1050 } while (groupIndex < av.getAlignment().getGroups().size());
1057 * Draw the selection group as a separate image and overlay
1059 private BufferedImage drawSelectionGroup()
1061 // get a new image of the correct size
1062 BufferedImage selectionImage = setupSelectionImage();
1064 if (selectionImage == null)
1069 SequenceGroup group = av.getSelectionGroup();
1076 // set up drawing colour
1077 Graphics2D g = (Graphics2D) selectionImage.getGraphics();
1078 // set background to transparent
1079 g.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
1080 g.fillRect(0, 0, selectionImage.getWidth(), selectionImage.getHeight());
1082 g.setComposite(AlphaComposite.Src);
1083 g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,
1084 BasicStroke.JOIN_ROUND, 3f, new float[]
1086 g.setColor(Color.RED);
1088 int visWidth = av.getRanges().getViewportWidth() * charWidth;
1090 int startRes = av.getRanges().getStartRes();
1092 // set x start and end positions of group
1093 int startx = (group.getStartRes() - startRes) * charWidth;
1094 int endx = (group.getEndRes() - startRes + 1) * charWidth;
1098 boolean inGroup = false;
1102 // get sequences to determine y positions of group
1103 int startSeq = av.getRanges().getStartSeq();
1104 for (i = startSeq; i <= av.getRanges().getEndSeq(); ++i)
1106 int sy = (i - startSeq) * charHeight;
1108 if (group.getSequences(null)
1109 .contains(av.getAlignment().getSequenceAt(i)))
1111 if ((bottom == -1) && !group.getSequences(null)
1112 .contains(av.getAlignment().getSequenceAt(i + 1)))
1114 bottom = sy + charHeight;
1119 if (((top == -1) && (i == 0)) || !group.getSequences(null)
1120 .contains(av.getAlignment().getSequenceAt(i - 1)))
1133 // if start position is visible, draw vertical line to left of
1135 if (startx >= 0 && startx < visWidth * charWidth)
1137 g.drawLine(startx, oldY, startx, sy);
1140 // if end position is visible, draw vertical line to right of
1142 if (endx <= visWidth * charWidth)
1144 g.drawLine(endx, oldY, endx, sy);
1147 if (endx > visWidth * charWidth)
1149 endx = visWidth * charWidth;
1152 // draw horizontal line at top of group
1155 g.drawLine(startx, top, endx, top);
1159 // draw horizontal line at bottom of group
1162 g.drawLine(startx, bottom, endx, bottom);
1172 int sy = (i - startSeq) * charHeight;
1173 if (startx >= 0 && startx < visWidth)
1175 g.drawLine(startx, oldY, startx, sy);
1178 if (endx < visWidth)
1180 g.drawLine(endx, oldY, endx, sy);
1183 if (endx > visWidth)
1190 g.drawLine(startx, top, endx, top);
1196 g.drawLine(startx, bottom - 1, endx, bottom - 1);
1203 return selectionImage;
1212 public void highlightSearchResults(SearchResultsI results)
1216 av.setSearchResults(results);
1222 public void propertyChange(PropertyChangeEvent evt)
1224 String eventName = evt.getPropertyName();
1226 if (av.getWrapAlignment())
1228 if (eventName.equals(ViewportRanges.STARTRES))
1236 if (eventName.equals(ViewportRanges.STARTRES))
1238 // Make sure we're not trying to draw a panel
1239 // larger than the visible window
1240 ViewportRanges vpRanges = av.getRanges();
1241 scrollX = (int) evt.getNewValue() - (int) evt.getOldValue();
1242 int range = vpRanges.getEndRes() - vpRanges.getStartRes();
1243 if (scrollX > range)
1247 else if (scrollX < -range)
1253 // Both scrolling and resizing change viewport ranges: scrolling changes
1254 // both start and end points, but resize only changes end values.
1255 // Here we only want to fastpaint on a scroll, with resize using a normal
1256 // paint, so scroll events are identified as changes to the horizontal or
1257 // vertical start value.
1258 if (eventName.equals(ViewportRanges.STARTRES))
1260 // scroll - startres and endres both change
1261 fastPaint(scrollX, 0);
1263 else if (eventName.equals(ViewportRanges.STARTSEQ))
1266 fastPaint(0, (int) evt.getNewValue() - (int) evt.getOldValue());