本文整理匯總了Java中java.awt.Rectangle.setRect方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle.setRect方法的具體用法?Java Rectangle.setRect怎麽用?Java Rectangle.setRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setRect方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setScrollBarValues
import java.awt.Rectangle; //導入方法依賴的package包/類
/**
* Corrects the scrollbar sync issue with JUNG 2.0.1
*
* recalculated at every scroll/translate/addvertex operation
*/
@Override
protected void setScrollBarValues(Rectangle rectangle, Point2D h0,
Point2D h1, Point2D v0, Point2D v1) {
// inject real graph bounds
rectangle.setRect(vv.getGraphBoundsCache());
// inject offset
BidirectionalTransformer viewTransformer = vv.getRenderContext()
.getMultiLayerTransformer().getTransformer(Layer.VIEW);
BidirectionalTransformer layoutTransformer = vv.getRenderContext()
.getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
Point2D location = layoutTransformer.inverseTransform(viewTransformer
.inverseTransform(new Point2D.Double()));
double xoff = h0.getX() - location.getX();
double yoff = v0.getY() - location.getY();
// offset
h0.setLocation(h0.getX() - xoff, h0.getY() - yoff);
h1.setLocation(h1.getX() - xoff, h1.getY() - yoff);
v0.setLocation(v0.getX() - xoff, v0.getY() - yoff);
v1.setLocation(v1.getX() - xoff, v1.getY() - yoff);
//
super.setScrollBarValues(rectangle, h0, h1, v0, v1);
}
示例2: getDialogBounds
import java.awt.Rectangle; //導入方法依賴的package包/類
private Rectangle getDialogBounds() {
String size = preferences.get(key, DELIMITER);
if(size != null) {
String[] dim = size.split(DELIMITER);
if(dim.length != 4 ||
dim[0].trim().equals("") || // NOI18N
dim[1].trim().equals("") || // NOI18N
dim[2].trim().equals("") || // NOI18N
dim[3].trim().equals("") ) // NOI18N
{
return null;
}
Rectangle r = new Rectangle();
r.setRect(Double.parseDouble(dim[0]),
Double.parseDouble(dim[1]),
Double.parseDouble(dim[2]),
Double.parseDouble(dim[3]));
return r;
}
return null;
}
示例3: getGlyphImageBounds
import java.awt.Rectangle; //導入方法依賴的package包/類
void getGlyphImageBounds(int glyphCode, Point2D.Float pt, Rectangle result) {
Rectangle2D.Float floatRect = new Rectangle2D.Float();
if (invDevTx != null) {
invDevTx.transform(pt, pt);
}
getGlyphImageBounds(glyphCode, pt.x, pt.y, floatRect);
if (floatRect.width == 0 && floatRect.height == 0) {
result.setRect(0, 0, -1, -1);
return;
}
result.setRect(floatRect.x + pt.x, floatRect.y + pt.y, floatRect.width, floatRect.height);
}
示例4: toRect
import java.awt.Rectangle; //導入方法依賴的package包/類
public static Rectangle toRect(Rectangle2D r2d) {
Rectangle r = new Rectangle();
r.setRect(r2d);
return r;
}