JScrollPane scrollPane;\r
AlignViewport av;\r
Font font;\r
- int fontSize;\r
+ FontMetrics fm;\r
boolean fitToWindow = true;\r
boolean showDistances = false;\r
boolean showBootstrap = false;\r
boolean markPlaceholders = false;\r
int offx = 20;\r
- int offy = 20;\r
+ int offy;\r
float threshold;\r
String longestName;\r
int labelLength = -1;\r
\r
String name = (markPlaceholders && node.isPlaceholder())\r
? (PLACEHOLDER + node.getName()) : node.getName();\r
- FontMetrics fm = g.getFontMetrics(font);\r
+\r
int charWidth = fm.stringWidth(name) + 3;\r
int charHeight = fm.getHeight();\r
\r
- Rectangle rect = new Rectangle(xend + 20, ypos - charHeight,\r
+ Rectangle rect = new Rectangle(xend+10, ypos-charHeight/2,\r
charWidth, charHeight);\r
\r
nameHash.put((SequenceI) node.element(), rect);\r
{\r
g.setColor(Color.gray);\r
\r
- g.fillRect(xend + 10, ypos - charHeight + 3, charWidth,\r
+ g.fillRect(xend + 10, ypos-charHeight/2, charWidth,\r
charHeight);\r
g.setColor(Color.white);\r
}\r
\r
- g.drawString(name, xend + 10, ypos);\r
+ g.drawString(name, xend + 10, ypos+fm.getDescent());\r
g.setColor(Color.black);\r
}\r
else\r
((SequenceNode) top.right()).count;\r
}\r
\r
- float chunk = (float) (height - (offy * 2)) / top.count;\r
+ float chunk = (float) (height - (offy)) / top.count;\r
\r
pickNode(pickBox, top, chunk, wscale, width, offx, offy);\r
}\r
}\r
else\r
{\r
- FontMetrics fm = g.getFontMetrics(font);\r
+ fm = g.getFontMetrics(font);\r
\r
if (nameHash.size() == 0)\r
{\r
}\r
}\r
\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public int getFontSize()\r
- {\r
- return fontSize;\r
- }\r
\r
/**\r
* DOCUMENT ME!\r
*\r
* @param fontSize DOCUMENT ME!\r
*/\r
- public void setFontSize(int fontSize)\r
+ public void setFont(Font font)\r
{\r
- this.fontSize = fontSize;\r
- font = new Font(font.getName(), font.getStyle(), fontSize);\r
+ this.font = font;\r
repaint();\r
}\r
\r
\r
g2.setFont(font);\r
\r
- labelLength = g2.getFontMetrics(font).stringWidth(longestName) + 20; //20 allows for scrollbar\r
+ offy = font.getSize()*2;\r
+\r
+ fm = g2.getFontMetrics(font);\r
+\r
+ labelLength = fm.stringWidth(longestName) + 20; //20 allows for scrollbar\r
\r
float wscale = (float) (width - labelLength - (offx * 2)) / tree.getMaxHeight();\r
\r
((SequenceNode) top.right()).count;\r
}\r
\r
- float chunk = (float) (height - (offy * 2)) / top.count;\r
+ float chunk = (float) (height - (offy)) / top.count;\r
\r
drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
\r