*\r
* @param b DOCUMENT ME!\r
*/\r
- public void renderGaps(boolean b)\r
+ public void prepare(Graphics g, boolean renderGaps)\r
{\r
- renderGaps = b;\r
+ graphics = g;\r
+ fm = g.getFontMetrics();\r
+ monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth();\r
+ this.renderGaps = renderGaps;\r
}\r
\r
\r
* @param width DOCUMENT ME!\r
* @param height DOCUMENT ME!\r
*/\r
- public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+ public void drawSequence(SequenceI seq, SequenceGroup[] sg,\r
int start, int end, int y1)\r
{\r
allGroups = sg;\r
\r
- graphics = g;\r
-\r
drawBoxes(seq, start, end, y1);\r
\r
- fm = g.getFontMetrics();\r
-\r
- monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth();\r
-\r
drawText(seq, start, end, y1);\r
}\r
\r
* @param width DOCUMENT ME!\r
* @param height DOCUMENT ME!\r
*/\r
- public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
- int y1, int width, int height)\r
+ public void drawHighlightedText(SequenceI seq, int start, int end, int x1, int y1)\r
{\r
- int pady = height / 5;\r
+ int pady = av.charHeight / 5;\r
int charOffset = 0;\r
graphics.setColor(Color.BLACK);\r
- graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
+ graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);\r
graphics.setColor(Color.white);\r
\r
char s = '~';\r
s = seq.getSequence().charAt(i);\r
}\r
\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (i - start)), (y1 + height) - pady);\r
+ charOffset + x1 + (av.charWidth * (i - start)),\r
+ (y1 + av.charHeight) - pady);\r
}\r
}\r
+\r
+ public void drawCursor(SequenceI seq, int res, int x1, int y1)\r
+ {\r
+ int pady = av.charHeight / 5;\r
+ int charOffset = 0;\r
+ graphics.setColor(Color.lightGray);\r
+ graphics.fillRect(x1, y1, av.charWidth, av.charHeight);\r
+ graphics.setColor(Color.white);\r
+\r
+ graphics.setColor(Color.white);\r
+\r
+ char s = seq.getCharAt(res);\r
+\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
+ graphics.drawString(String.valueOf(s),\r
+ charOffset + x1,\r
+ (y1 + av.charHeight) - pady);\r
+\r
+\r
+ }\r
}\r