@Override public double getWidth(Tree tree) { String s = getText(tree); return doc.getWidth(s) + nodeWidthPadding*2; }
@Override public double getHeight(Tree tree) { String s = getText(tree); double h = doc.getLineHeight() + nodeHeightPaddingAbove + nodeHeightPaddingBelow; String[] lines = s.split("\n"); return h * lines.length; } }
@Override public double getWidth(Tree tree) { String s = getText(tree); return doc.getWidth(s) + nodeWidthPadding*2; }
@Override public double getHeight(Tree tree) { String s = getText(tree); double h = doc.getLineHeight() + nodeHeightPaddingAbove + nodeHeightPaddingBelow; String[] lines = s.split("\n"); return h * lines.length; } }
@Override public double getWidth(Tree tree) { String s = getText(tree); return doc.getWidth(s) + nodeWidthPadding*2; }
@Override public double getHeight(Tree tree) { String s = getText(tree); double h = doc.getLineHeight() + nodeHeightPaddingAbove + nodeHeightPaddingBelow; String[] lines = s.split("\n"); return h * lines.length; } }
@Override public double getHeight(Tree tree) { String s = getText(tree); double h = doc.getLineHeight() + nodeHeightPaddingAbove + nodeHeightPaddingBelow; String[] lines = s.split("\n"); return h * lines.length; } }
@Override public double getWidth(Tree tree) { String s = getText(tree); return doc.getWidth(s) + nodeWidthPadding*2; }
protected void generateNode(Tree t) { // draw the text on top of the box (possibly multiple lines) String[] lines = getText(t).split("\n"); Rectangle2D.Double box = getBoundsOfNode(t); // for debugging, turn this on to see boundingbox of nodes //doc.rect(box.x, box.y, box.width, box.height); // make error nodes from parse tree red by default if ( t instanceof ErrorNode ) { doc.highlight(box.x, box.y, box.width, box.height); } double x = box.x+nodeWidthPadding; double y = box.y+nodeHeightPaddingBelow; for (int i = 0; i < lines.length; i++) { doc.text(lines[i], x, y); y += doc.getLineHeight(); } }
protected void generateNode(Tree t) { // draw the text on top of the box (possibly multiple lines) String[] lines = getText(t).split("\n"); Rectangle2D.Double box = getBoundsOfNode(t); // for debugging, turn this on to see boundingbox of nodes //doc.rect(box.x, box.y, box.width, box.height); // make error nodes from parse tree red by default if ( t instanceof ErrorNode ) { doc.highlight(box.x, box.y, box.width, box.height); } double x = box.x+nodeWidthPadding; double y = box.y+nodeHeightPaddingBelow; for (int i = 0; i < lines.length; i++) { doc.text(lines[i], x, y); y += doc.getLineHeight(); } }
protected void generateNode(Tree t) { // draw the text on top of the box (possibly multiple lines) String[] lines = getText(t).split("\n"); Rectangle2D.Double box = getBoundsOfNode(t); // for debugging, turn this on to see boundingbox of nodes //doc.rect(box.x, box.y, box.width, box.height); // make error nodes from parse tree red by default if ( t instanceof ErrorNode ) { doc.highlight(box.x, box.y, box.width, box.height); } double x = box.x+nodeWidthPadding; double y = box.y+nodeHeightPaddingBelow; for (int i = 0; i < lines.length; i++) { doc.text(lines[i], x, y); y += doc.getLineHeight(); } }
protected void generateNode(Tree t) { // draw the text on top of the box (possibly multiple lines) String[] lines = getText(t).split("\n"); Rectangle2D.Double box = getBoundsOfNode(t); // for debugging, turn this on to see boundingbox of nodes //doc.rect(box.x, box.y, box.width, box.height); // make error nodes from parse tree red by default if ( t instanceof ErrorNode ) { doc.highlight(box.x, box.y, box.width, box.height); } double x = box.x+nodeWidthPadding; double y = box.y+nodeHeightPaddingBelow; for (int i = 0; i < lines.length; i++) { doc.text(lines[i], x, y); y += doc.getLineHeight(); } }