import java.awt.Insets;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
hscroll.addAdjustmentListener(this);
vscroll.addAdjustmentListener(this);
+ addComponentListener(new ComponentAdapter()
+ {
+ @Override
+ public void componentResized(ComponentEvent evt)
+ {
+ // reset the viewport ranges when the alignment panel is resized
+ // in particular, this initialises the end residue value when Jalview
+ // is initialised
+ int widthInRes = (getSeqPanel().seqCanvas.getWidth() / av
+ .getCharWidth()) - 1;
+ int currentStartRes = vpRanges.getStartRes();
+ if (av.getWrapAlignment())
+ {
+ widthInRes = getSeqPanel().seqCanvas
+ .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth());
+ }
+
+ vpRanges.setStartEndRes(currentStartRes, widthInRes);
+ }
+
+ });
+
final AlignmentPanel ap = this;
propertyChangeListener = new PropertyChangeListener()
{