}\r
\r
\r
+public void fastPaint(int horizontal, int vertical)\r
+{\r
+ if(horizontal==0 && vertical==0)\r
+ {\r
+ return;\r
+ }\r
+\r
+\r
+ if (img==null || paintFlag)\r
+ {\r
+ repaint();\r
+ return;\r
+ }\r
+\r
+ gg.copyArea( 0,0, imgWidth, imgHeight, -horizontal*av.charWidth, -vertical*av.charHeight );\r
+\r
+ int sr=av.startRes, er=av.endRes+1, ss = av.startSeq, es = av.endSeq, transX=0, transY = 0;\r
+ if(horizontal>0) // scrollbar pulled right, image to the left\r
+ {\r
+ transX = (er-sr-horizontal)*av.charWidth;\r
+ sr = er - horizontal ;\r
+ }\r
+ else if(horizontal<0)\r
+ {\r
+ er = sr-horizontal;\r
+ }\r
+\r
+\r
+\r
+\r
+ if(vertical>0) // scroll down\r
+ {\r
+ transY = imgHeight - vertical*av.charHeight;\r
+ ss = es - vertical;\r
+ }\r
+ else if(vertical<0)\r
+ {\r
+\r
+ es = ss-vertical;\r
+\r
+ }\r
+\r
+ gg.translate(transX, transY);\r
+\r
+ drawPanel(gg, sr,er,ss,es,sr,ss,0);\r
+\r
+ gg.translate( -transX, -transY );\r
+ getGraphics().drawImage(img,0,0,this);\r
+\r
+}\r
+\r
/**\r
* Definitions of startx and endx (hopefully):\r
* SMJS This is what I'm working towards!\r
\r
public void paintComponent(Graphics g)\r
{\r
+ // this draws the whole of the alignment\r
\r
- if (img==null || imgWidth!=getWidth() || imgHeight!=getHeight() || paintFlag)\r
- {\r
imgWidth = getWidth();\r
imgHeight = getHeight();\r
+\r
+ imgWidth -= imgWidth%av.charWidth;\r
+ imgHeight-= imgHeight%av.charHeight;\r
+\r
img = createImage(imgWidth,imgHeight);\r
gg = (Graphics2D)img.getGraphics();\r
gg.setFont(av.getFont());\r
gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
+ gg.setClip(0,0,imgWidth, imgHeight);\r
paintFlag = false;\r
- }\r
\r
\r
chunkWidth = getWidth()/av.charWidth;\r
av.setChunkHeight(chunkHeight);\r
av.setChunkWidth(chunkWidth);\r
\r
- gg.setColor(Color.WHITE);\r
- gg.fillRect(0,0,imgWidth,imgHeight);\r
+ g.setColor(Color.WHITE);\r
+ g.fillRect(0,0,getWidth(), getHeight());\r
\r
if (av.getWrapAlignment())\r
drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes);\r
inGroup = true;\r
if (group == av.getSelectionGroup())\r
{\r
- g.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,2f,2f}, 0f ));\r
+ // g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,2f,2f}, 0f ));\r
g.setColor(Color.RED);\r
}\r
else\r