public final class Utils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
drawDiamond(java.awt.Graphics2D g2,
java.awt.Color color,
double x0,
double y0,
double r)
Draw diamond
|
static void |
drawDot(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
double r)
Draw dot
|
static void |
drawEllipse(java.awt.Graphics2D g2,
double x0,
double y0)
Draw ellipse
|
static void |
drawTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w,
int h2,
boolean reverse)
Draw triangle
|
static void |
drawTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w,
int h2,
boolean reverse,
double rotation) |
static void |
drawUpwardTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w2,
int h)
Draw triangle
|
static int |
getCenteringOffset(int n,
int w)
Get centering offset for a node with n edges and given x2
|
static java.awt.Dimension |
getLabelDimension(java.lang.String text,
java.awt.Font font)
Get label dimensions
|
static java.lang.String |
truncate(java.lang.String label,
int width,
java.awt.FontMetrics metrics)
Truncate label to width
|
public static java.lang.String truncate(java.lang.String label,
int width,
java.awt.FontMetrics metrics)
label - labelwidth - widthmetrics - font metricspublic static void drawDot(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
double r)
g2 - graphics contextcolor - colorx0 - x coordinatey0 - y coordinater - radiuspublic static void drawEllipse(java.awt.Graphics2D g2,
double x0,
double y0)
g2 - graphics contextx0 - x coordinatey0 - y coordinatepublic static void drawDiamond(java.awt.Graphics2D g2,
java.awt.Color color,
double x0,
double y0,
double r)
g2 - graphics contextcolor - colorx0 - x coordinatey0 - y coordinater - radiuspublic static void drawTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w,
int h2,
boolean reverse)
g2 - graphics contextcolor - colorx0 - x coordinatey0 - y coordinatew - arrow widthh2 - arrow half heightreverse - reversepublic static void drawTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w,
int h2,
boolean reverse,
double rotation)
g2 - graphics contextcolor - colorx0 - x coordinatey0 - y coordinatew - arrow widthh2 - arrow half heightreverse - reverserotation - rotation of trianglepublic static void drawUpwardTriangle(java.awt.Graphics2D g2,
java.awt.Color color,
int x0,
int y0,
int w2,
int h)
g2 - graphics contextcolor - colorx0 - x coordinatey0 - y coordinatew2 - arrow half widthh - arrow heightpublic static int getCenteringOffset(int n,
int w)
n - number of incoming and outgoing nodesw - x2public static java.awt.Dimension getLabelDimension(java.lang.String text,
java.awt.Font font)
text - label textfont - font