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);
overlay.getBounds().setSize(overlay.getPreferredSize());
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); }
@Override public void updateComponent() { fm = getFontMetrics(font); textBox.setSize(fm.stringWidth(text),fm.getHeight()); textBox.grow(PADDING_X, PADDING_Y); setLocationRelativeToRegion(getTarget(), layout); }
/** * 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)); }
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);
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(); }
bounds.setSize(x - bounds.x, y - bounds.y);
rectTable.setSize(tableDim);
(int) Math.round((IMAGE_DIMENSION_PNG.height - image.getHeight()) / 2.0) ); sourceRegion.setSize(image.getWidth(), image.getHeight());
/** * 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); }
/** * 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); }
/** * 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); }
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(); }
// 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);
@Override public void updateComponent() { fm = getFontMetrics(font); textBox.setSize(fm.stringWidth(text),fm.getHeight()); textBox.grow(PADDING_X, PADDING_Y); setLocationRelativeToRegion(getTarget(), layout); }
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(); }