本文整理汇总了Java中java.awt.geom.Rectangle2D.add方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle2D.add方法的具体用法?Java Rectangle2D.add怎么用?Java Rectangle2D.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Rectangle2D
的用法示例。
在下文中一共展示了Rectangle2D.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGroupBounds
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
private Rectangle2D getGroupBounds() {
int nShapes = contents.size();
Rectangle2D bounds = new Rectangle2D.Double(0, 0, 0, 0);
for (int i = 0; i < nShapes; i++) {
if (i == 0) {
bounds.setRect(contents.get(i).getBounds());
} else {
bounds.add(contents.get(i).getBounds());
}
}
return bounds;
}
示例2: adjustBounds
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
@Override
public void adjustBounds(Rectangle2D bb) {
// Fix this eventually to compute the true bounds
bb.add(x1, y1);
bb.add(x2, y2);
bb.add(x3, y3);
}
示例3: randomCoordinate
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Returns a random number bounded by <tt>toJCellMap.size()</tt>. Used to
* generate a random position for any added j-vertex without layout
* information.
*/
@SuppressWarnings("unchecked")
protected int randomCoordinate() {
Rectangle2D bounds = new Rectangle();
for (Object cell : getJGraph().getSelectionCells()) {
if (cell instanceof JVertex) {
bounds.add(((JVertex<G>) cell).getVisuals()
.getNodePos());
}
}
return 25 + randomGenerator
.nextInt((this.nodeJCellMap.size() + this.edgeJCellMap.size()) * 5 + 1);
}
示例4: getVisualBounds
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Return the union of the visual bounds of all the components.
* This incorporates the path. It does not include logical
* bounds (used by carets).
*/
public Rectangle2D getVisualBounds() {
Rectangle2D result = null;
for (int i = 0, n = 0; i < fComponents.length; i++, n += 2) {
TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)];
Rectangle2D r = tlc.getVisualBounds();
Point2D.Float pt = new Point2D.Float(locs[n], locs[n+1]);
if (lp == null) {
r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y,
r.getWidth(), r.getHeight());
} else {
lp.pathToPoint(pt, false, pt);
AffineTransform at = tlc.getBaselineTransform();
if (at != null) {
AffineTransform tx = AffineTransform.getTranslateInstance
(pt.x - at.getTranslateX(), pt.y - at.getTranslateY());
tx.concatenate(at);
r = tx.createTransformedShape(r).getBounds2D();
} else {
r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y,
r.getWidth(), r.getHeight());
}
}
if (result == null) {
result = r;
} else {
result.add(r);
}
}
if (result == null) {
result = new Rectangle2D.Float(Float.MAX_VALUE, Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE);
}
return result;
}
示例5: enlarge
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
public void enlarge(Rectangle2D r) {
r.add(x0, y0);
double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
for (int i = 0; i < numroots; i++) {
double t = eqn[i];
if (t > 0 && t < 1) {
r.add(XforT(t), YforT(t));
}
}
r.add(x1, y1);
}
示例6: enlarge
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
public void enlarge(Rectangle2D r) {
r.add(x0, y0);
double t = -xcoeff1 / (2 * xcoeff2);
if (t > 0 && t < 1) {
r.add(XforT(t), YforT(t));
}
r.add(x1, y1);
}
示例7: enlarge
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
public void enlarge(Rectangle2D r) {
r.add(x, y);
}
示例8: getVisualBounds
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
public Rectangle2D getVisualBounds(Label label) {
Rectangle2D visBounds = label.handleGetVisualBounds();
if (swapColors || bgPaint != null || strikethrough
|| stdUnderline != null || imUnderline != null) {
float minX = 0;
Rectangle2D lb = label.getLogicalBounds();
float minY = 0, maxY = 0;
if (swapColors || bgPaint != null) {
minY = (float)lb.getY();
maxY = minY + (float)lb.getHeight();
}
maxY = Math.max(maxY, getUnderlineMaxY(label.getCoreMetrics()));
Rectangle2D ab = new Rectangle2D.Float(minX, minY, (float)lb.getWidth(), maxY-minY);
visBounds.add(ab);
}
return visBounds;
}
示例9: enlarge
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
public void enlarge(Rectangle2D r) {
r.add(x0, y0);
r.add(x1, y1);
}