本文整理了Java中java.awt.Rectangle.setSize
方法的一些代码示例,展示了Rectangle.setSize
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.setSize
方法的具体详情如下:
包路径:java.awt.Rectangle
类名称:Rectangle
方法名:setSize
[英]Sets the size of this Rectangle
to the specified width and height.
This method is included for completeness, to parallel the setSize
method of Component
.
[中]将此Rectangle
的大小设置为指定的宽度和高度。
包含此方法是为了完整性,与Component
的setSize
方法并行。
代码示例来源:origin: runelite/runelite
outsideStroke.setSize(rectangle.width - BORDER_OFFSET / 2, rectangle.height - BORDER_OFFSET / 2);
graphics.setColor(outsideStrokeColor);
graphics.draw(outsideStroke);
insideStroke.setSize(rectangle.width - BORDER_OFFSET - BORDER_OFFSET / 2,
rectangle.height - BORDER_OFFSET - BORDER_OFFSET / 2);
graphics.setColor(insideStrokeColor);
代码示例来源:origin: runelite/runelite
overlay.getBounds().setSize(overlay.getPreferredSize());
代码示例来源:origin: runelite/runelite
bounds.setSize(TAB_WIDTH + MARGIN * 2, height);
bounds.setLocation(MARGIN, TAB_HEIGHT + MARGIN);
child.setSpriteId(TabSprites.INCINERATOR.getSpriteId());
bounds.setSize(TAB_WIDTH + MARGIN * 2, height - incinerator.getHeight());
代码示例来源:origin: nodebox/nodebox
public static void centerOnScreen(Window w, Window parent) {
Rectangle r = new Rectangle();
if (parent == null) {
r.setSize(Toolkit.getDefaultToolkit().getScreenSize());
} else {
r.setLocation(parent.getLocation());
r.setSize(parent.getSize());
}
// Determine the new location of the alert
int x = r.x + (r.width - w.getWidth()) / 2;
int y = r.y + (r.height - w.getHeight()) / 2;
// Move the alert
w.setLocation(x, y);
}
代码示例来源:origin: RaiMan/SikuliX2
@Override
public void updateComponent() {
fm = getFontMetrics(font);
textBox.setSize(fm.stringWidth(text),fm.getHeight());
textBox.grow(PADDING_X, PADDING_Y);
setLocationRelativeToRegion(getTarget(), layout);
}
代码示例来源:origin: haraldk/TwelveMonkeys
/**
* Reads the rectangle location and size from an 8-byte rectangle stream.
*
* @param pStream the stream to read from
* @param pDestRect the rectangle to read into
*
* @throws NullPointerException if {@code pDestRect} is {@code null}
* @throws IOException if an I/O error occurs while reading the image.
*/
private void readRectangle(DataInput pStream, Rectangle pDestRect) throws IOException {
int y = pStream.readUnsignedShort();
int x = pStream.readUnsignedShort();
int h = pStream.readUnsignedShort();
int w = pStream.readUnsignedShort();
pDestRect.setLocation(getXPtCoord(x), getYPtCoord(y));
pDestRect.setSize(getXPtCoord(w - x), getYPtCoord(h - y));
}
代码示例来源:origin: RaiMan/SikuliX2
public void setDirection(int direction){
this.direction = direction;
if (direction == DIRECTION_EAST || direction == DIRECTION_WEST){
triangle.setSize(10,textBox.height);
canonicalSize = new Dimension(textBox.width + triangle.width, textBox.height);
}else{
triangle.setSize(20, 10);
setActualSize(textBox.width, textBox.height + triangle.height);
canonicalSize = new Dimension(textBox.width, textBox.height + triangle.height);
代码示例来源:origin: RaiMan/SikuliX2
public void setActualSize(Dimension actualSize) {
actualBounds.setSize(actualSize);
Dimension paintSize = (Dimension) actualSize.clone();
if (hasShadow()) {
paintSize.width += (2 * shadowSize);
paintSize.height += (2 * shadowSize);
}
super.setSize(paintSize);
updateAllFollowers();
}
代码示例来源:origin: haraldk/TwelveMonkeys
bounds.setSize(x - bounds.x, y - bounds.y);
代码示例来源:origin: RaiMan/SikuliX2
rectTable.setSize(tableDim);
代码示例来源:origin: haraldk/TwelveMonkeys
bounds.setSize(x - bounds.x, y - bounds.y);
if (DEBUG) {
System.out.print(", bounds: " + bounds);
srcRect.setSize(x - srcRect.x, y - srcRect.y);
代码示例来源:origin: haraldk/TwelveMonkeys
(int) Math.round((IMAGE_DIMENSION_PNG.height - image.getHeight()) / 2.0)
);
sourceRegion.setSize(image.getWidth(), image.getHeight());
代码示例来源:origin: haraldk/TwelveMonkeys
bounds.setSize(x - bounds.x, y - bounds.y);
if (DEBUG) {
System.out.print(", bounds: " + bounds);
srcRect.setSize(x - srcRect.x, y - srcRect.y);
代码示例来源:origin: igvteam/igv
/**
* Updates the dimensions for both thumbs.
*/
@Override
protected void calculateThumbSize() {
// Call superclass method for lower thumb size.
super.calculateThumbSize();
// Set upper thumb size.
upperThumbRect.setSize(thumbRect.width, thumbRect.height);
}
代码示例来源:origin: org.gephi/ui-components
/**
* Updates the dimensions for both thumbs.
*/
@Override
protected void calculateThumbSize() {
// Call superclass method for lower thumb size.
super.calculateThumbSize();
// Set upper thumb size.
upperThumbRect.setSize(thumbRect.width, thumbRect.height);
}
代码示例来源:origin: org.gephi/ui-components
/**
* Updates the dimensions for both thumbs.
*/
@Override
protected void calculateThumbSize() {
// Call superclass method for lower thumb size.
super.calculateThumbSize();
// Set upper thumb size.
upperThumbRect.setSize(thumbRect.width, thumbRect.height);
}
代码示例来源:origin: Audiveris/audiveris
private void updateSize (MouseEvent e)
{
// Update width and height of rawRect
rawRect.setSize(e.getX() - rawRect.x, e.getY() - rawRect.y);
normalize();
// Repaint the component (with the resized rectangle)
component.repaint();
}
代码示例来源:origin: stackoverflow.com
// innerRect and dimension are part of the outer block's scope (bad)
Rectangle rectangle4 = new Rectangle();
rectangle4.setLocation(-50, -20);
Rectangle innerRect = new Rectangle();
innerRect.setLocation(0, 0);
Dimension dimension = new Dimension();
dimension.setSize(640, 480);
innerRect.setSize(dimension);
rectangle4.setBounds(innerRect);
代码示例来源:origin: com.sikulix/sikulixapi
@Override
public void updateComponent() {
fm = getFontMetrics(font);
textBox.setSize(fm.stringWidth(text),fm.getHeight());
textBox.grow(PADDING_X, PADDING_Y);
setLocationRelativeToRegion(getTarget(), layout);
}
代码示例来源:origin: com.sikulix/sikulixapi
public void setActualSize(Dimension actualSize) {
actualBounds.setSize(actualSize);
Dimension paintSize = (Dimension) actualSize.clone();
if (hasShadow()) {
paintSize.width += (2 * shadowSize);
paintSize.height += (2 * shadowSize);
}
super.setSize(paintSize);
updateAllFollowers();
}
内容来源于网络,如有侵权,请联系作者删除!