height+=20;
width = (int) Math.ceil(width * theScale);
height = (int) Math.ceil(height * theScale);
}
JPowerGraphColor oldBGColor = g.getBackground();
JPowerGraphColor oldFGColor = g.getForeground();
g.setBackground(getBackgroundColor(node, graphPane, theSubGraphHighlighter));
if (shape == RECTANGLE){
g.fillRectangle(thePoint.x-width/2,thePoint.y-height/2,width,height);
}
else if (shape == ELLIPSE){
g.fillOval(thePoint.x-width/2,thePoint.y-height/2,width,height);
}
else if (shape == TRIANGLE){
int x1 = thePoint.x - width/2;
int y1 = thePoint.y + height/2;
int x2 = x1 + width/2;
int y2 = thePoint.y - height/2 - width/10;
int x3 = x1 + width;
int y3 = y1;
g.fillPolygon(new int[]{x1, y1, x2, y2, x3, y3});
}
if (label!=null) {
g.storeFont();
g.setFontFromJGraphPane(graphPane);
g.setForeground(getTextColor(node, graphPane, theSubGraphHighlighter));
ArrayList <String> lines = getLines(label);
for (int i = 0; i < lines.size(); i++){
int offset = (g.getAscent() + g.getDescent() + 2) * i;
g.drawString(lines.get(i), textX, textY + offset, lines.size());
}
g.restoreFont();
}
g.setForeground(getBorderColor(node, graphPane, theSubGraphHighlighter));
if (shape == RECTANGLE){
g.drawRectangle(thePoint.x-width/2,thePoint.y-height/2,width,height);
}
else if (shape == ELLIPSE){
g.drawOval(thePoint.x-width/2,thePoint.y-height/2,width,height);
}
else if (shape == TRIANGLE){
int x1 = thePoint.x - width/2;
int y1 = thePoint.y + height/2;
int x2 = x1 + width/2;
int y2 = thePoint.y - height/2 - width/10;
int x3 = x1 + width;
int y3 = y1;
g.drawPolygon(new int[]{x1, y1, x2, y2, x3, y3});
}
g.setBackground(oldBGColor);
g.setForeground(oldFGColor);
}
else if (size == NodePainter.SMALL){
int width=18;
int height=8;
width = (int) Math.ceil(width * theScale);
height = (int) Math.ceil(height * theScale);
int textX = thePoint.x + width;
int textY = thePoint.y - 7;
String label=node.getLabel();
JPowerGraphColor oldBGColor = g.getBackground();
JPowerGraphColor oldFGColor = g.getForeground();
g.setBackground(getBackgroundColor(node, graphPane, theSubGraphHighlighter));
if (shape == RECTANGLE){
g.fillRectangle(thePoint.x-width/2,thePoint.y-height/2,width,height);
}
else if (shape == ELLIPSE){