public void setRelativeTargetValue(final float zeroToOne) { PNode.this.setBounds(src.x + zeroToOne * (dst.x - src.x), src.y + zeroToOne * (dst.y - src.y), src.width + zeroToOne * (dst.width - src.width), src.height + zeroToOne * (dst.height - src.height)); }
/** * Set the empty bit of this bounds to true. */ public void resetBounds() { setBounds(0, 0, 0, 0); }
/** * Set the bounds of this node to the given value. These bounds are stored * in the local coordinate system of this node. * * @param newBounds bounds to apply to this node * * @return true if the bounds changed. */ public boolean setBounds(final Rectangle2D newBounds) { return setBounds(newBounds.getX(), newBounds.getY(), newBounds.getWidth(), newBounds.getHeight()); }
/** {@inheritDoc} */ public boolean setBounds(final double x, final double y, final double width, final double height) { final boolean boundsChanged = super.setBounds(x, y, width, height); update(); return boundsChanged; }
/** {@inheritDoc} */ public boolean setBounds(final Rectangle2D newBounds) { final boolean boundsChanged = super.setBounds(newBounds); update(); return boundsChanged; }
/** * Create a HTML text node with the specified HTML text, font, and text * color. The font and text color are used to render the HTML text if not * otherwise specified via CSS. * * @param text HTML text for this HTML text node * @param font font for this HTML text node * @param textColor text color for this HTML text node */ public PHtmlView(final String text, final Font font, final Color textColor) { label = new JLabel(text); label.setFont(font); label.setForeground(textColor); super.setBounds(0, 0, label.getPreferredSize().getWidth(), label.getPreferredSize().getHeight()); update(); }
/** * Recalculates the path's bounds by examining it's associated shape. */ public void updateBoundsFromPath() { updatingBoundsFromPath = true; if (origShape == null) { resetBounds(); } else { final Rectangle2D b = origShape.getBounds2D(); // Note that this pen width code does not really work for SWT since // it assumes // that the pen width scales - in actuality it does not. However, // the fix would // be to have volatile bounds for all shapes which isn't a nice // alternative super.setBounds(b.getX() - PEN_WIDTH, b.getY() - PEN_WIDTH, b.getWidth() + 2 * PEN_WIDTH, b.getHeight() + 2 * PEN_WIDTH); } updatingBoundsFromPath = false; }
/** {@inheritDoc} */ public boolean setBounds(final double x, final double y, final double width, final double height) { final PBounds b = new PBounds(x, y, width, height); camera.localToGlobal(b); camera.localToView(b); target.globalToLocal(b); target.setBounds(b); return super.setBounds(x, y, width, height); }
/** * Center the bounds of this node so that they are centered on the given * point specified on the local coordinates of this node. Note that this * method will modify the nodes bounds, while centerFullBoundsOnPoint will * modify the nodes transform. * * @param localX x position of point around which to center bounds * @param localY y position of point around which to center bounds * * @return true if the bounds changed. */ public boolean centerBoundsOnPoint(final double localX, final double localY) { final double dx = localX - bounds.getCenterX(); final double dy = localY - bounds.getCenterY(); return setBounds(bounds.x + dx, bounds.y + dy, bounds.width, bounds.height); }
/** * Set's this node's bounds top position, leaving x, width, and height * unchanged. * * @param y new y position of bounds * * @return whether the change was successful */ public boolean setY(final double y) { return setBounds(getX(), y, getWidth(), getHeight()); }
/** * Set's this node's bounds left position, leaving y, width, and height * unchanged. * * @param x new x position of bounds * * @return whether the change was successful */ public boolean setX(final double x) { return setBounds(x, getY(), getWidth(), getHeight()); }
/** * Set's this node's bounds height, leaving x, y, and width unchanged. * * @param height new height position of bounds * * @return whether the change was successful */ public boolean setHeight(final double height) { return setBounds(getX(), getY(), getWidth(), height); }
/** * Set's this node's bounds width, leaving x, y, and height unchanged. * * @param width new width position of bounds * * @return whether the change was successful */ public boolean setWidth(final double width) { return setBounds(getX(), getY(), width, getHeight()); }
final double height, final long duration) { if (duration == 0) { setBounds(x, y, width, height); return null;
/** * Resizes the height to be as tall as its rendered html. Takes wrapping * into account. */ private void fitHeightToHtmlContent() { if (getWidth() > 0) { htmlView.setSize((float) getWidth(), 0f); float wrapHeight = htmlView.getPreferredSpan(View.Y_AXIS); label.setSize(new Dimension((int) getWidth(), (int) wrapHeight)); if (getHeight() < wrapHeight) { System.out.println(getHeight()); System.out.println(wrapHeight); super.setBounds(getX(), getY(), getWidth(), wrapHeight); } } }
super.setBounds(getX(), getY(), newWidth, newHeight);