AlignViewport av;\r
public static final String PLACEHOLDER = " * ";\r
Font font;\r
- int fontSize = 12;\r
-\r
boolean fitToWindow = true;\r
boolean showDistances = false;\r
boolean showBootstrap = false;\r
boolean markPlaceholders = false;\r
\r
int offx = 20;\r
- int offy = 20;\r
+ int offy;\r
\r
float threshold;\r
\r
public TreeCanvas(AlignViewport av, ScrollPane scroller)\r
{\r
this.av = av;\r
+ font = av.getFont();\r
scrollPane = scroller;\r
addMouseListener(this);\r
setLayout(null);\r
}\r
if (!nodeLabel.equals(""))\r
{\r
- g.drawString(nodeLabel, xstart, ypos - 10);\r
+ g.drawString(nodeLabel, xstart+2, ypos - 2);\r
}\r
\r
String name = (markPlaceholders && node.isPlaceholder()) ?\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,\r
charWidth, charHeight);\r
\r
nameHash.put( (SequenceI) node.element(), rect);\r
\r
if (showDistances && node.dist > 0)\r
{\r
- g.drawString(new Format("%-.2f").form(node.dist), xstart, ypos - 5);\r
+ g.drawString(new Format("%-.2f").form(node.dist), xstart+2, ypos - 2);\r
}\r
\r
}\r
top.count = ( (SequenceNode) top.left()).count +\r
( (SequenceNode) top.right()).count;\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
public void paint(Graphics g)\r
{\r
\r
- font = new Font("Verdana", Font.PLAIN, fontSize);\r
+ if(tree==null)\r
+ return;\r
+\r
g.setFont(font);\r
\r
FontMetrics fm = g.getFontMetrics(font);\r
scrollPane.validate();\r
}\r
\r
- public int getFontSize()\r
- {\r
- return fontSize;\r
- }\r
-\r
- public void setFontSize(int fontSize)\r
- {\r
- this.fontSize = fontSize;\r
- repaint();\r
- }\r
\r
public void draw(Graphics g, int width, int height)\r
{\r
+ offy = font.getSize()+10;\r
\r
g.setColor(Color.white);\r
g.fillRect(0, 0, width, height);\r
top.count = ( (SequenceNode) top.left()).count +\r
( (SequenceNode) top.right()).count;\r
}\r
- float chunk = (float) (height - offy * 2) / top.count;\r
+ float chunk = (float) (height - offy) / top.count;\r
\r
drawNode(g, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
\r