本文整理匯總了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);
}