本文整理汇总了Java中edu.umd.cs.piccolo.util.PBounds.getCenterY方法的典型用法代码示例。如果您正苦于以下问题:Java PBounds.getCenterY方法的具体用法?Java PBounds.getCenterY怎么用?Java PBounds.getCenterY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.util.PBounds
的用法示例。
在下文中一共展示了PBounds.getCenterY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: relocateHandle
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
/**
* Force this handle to relocate itself using its locator.
*/
public void relocateHandle() {
if (locator != null) {
final PBounds b = getBoundsReference();
final Point2D aPoint = locator.locatePoint(null);
if (locator instanceof PNodeLocator) {
final PNode located = ((PNodeLocator) locator).getNode();
final PNode parent = getParent();
located.localToGlobal(aPoint);
globalToLocal(aPoint);
if (parent != located && parent instanceof PCamera) {
((PCamera) parent).viewToLocal(aPoint);
}
}
final double newCenterX = aPoint.getX();
final double newCenterY = aPoint.getY();
if (newCenterX != b.getCenterX() || newCenterY != b.getCenterY()) {
centerBoundsOnPoint(newCenterX, newCenterY);
}
}
}
示例2: relocateHandle
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
/**
* Force this handle to relocate itself using its locator.
*/
public void relocateHandle() {
if (locator == null) {
return;
}
final PBounds b = getBoundsReference();
final Point2D aPoint = locator.locatePoint(null);
if (locator instanceof PNodeLocator) {
final PNode located = ((PNodeLocator) locator).getNode();
final PNode parent = getParent();
located.localToGlobal(aPoint);
globalToLocal(aPoint);
if (parent != located && parent instanceof PCamera) {
((PCamera) parent).viewToLocal(aPoint);
}
}
final double newCenterX = aPoint.getX();
final double newCenterY = aPoint.getY();
if (newCenterX != b.getCenterX() || newCenterY != b.getCenterY()) {
centerBoundsOnPoint(newCenterX, newCenterY);
}
}
示例3: createArrowShape
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
private static GeneralPath createArrowShape( final double scale, final ArrayList<PNode> highlights ) {
final PBounds highlightBounds = highlights.get( 0 ).getFullBounds();
Vector2D tickA = new Vector2D( highlightBounds.getX() + 1, highlightBounds.getCenterY() );
double headWidth = 10.0 / scale;
return new Arrow( tickA.plus( -5, 0 ).toPoint2D(), tickA.toPoint2D(), headWidth, headWidth, headWidth / 2.0 ).getShape();
}
示例4: createContentNode
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
private static PNode createContentNode( String text, Font font, Color foreground, Color disabledForeground, boolean enabled, BufferedImage image, BufferedImage disabledImage, TextPosition textPosition, double imageTextGap ) {
PNode textNode = createTextNode( text, font, foreground, disabledForeground, enabled );
PNode imageNode = createImageNode( image, disabledImage, enabled );
PComposite content = new PComposite();
content.addChild( textNode );
content.addChild( imageNode );
// layout text and image
double textX, imageX = 0;
double textY, imageY = 0;
PBounds tb = textNode.getFullBoundsReference();
PBounds ib = imageNode.getFullBoundsReference();
if ( textPosition == TextPosition.ABOVE ) {
textX = 0;
imageX = tb.getCenterX() - ( ib.getWidth() / 2 );
textY = 0;
imageY = tb.getMaxY() + imageTextGap;
}
else if ( textPosition == TextPosition.BELOW ) {
imageX = 0;
textX = ib.getCenterX() - ( tb.getWidth() / 2 );
imageY = 0;
textY = ib.getMaxY() + imageTextGap;
}
else if ( textPosition == TextPosition.LEFT ) {
textX = 0;
imageX = tb.getMaxX() + imageTextGap;
textY = 0;
imageY = tb.getCenterY() - ( ib.getHeight() / 2 );
}
else if ( textPosition == TextPosition.RIGHT ) {
imageX = 0;
textX = ib.getMaxX() + imageTextGap;
imageY = 0;
textY = ib.getCenterY() - ( tb.getHeight() / 2 );
}
else {
throw new UnsupportedOperationException( "unsupported text position: " + textPosition );
}
textNode.setOffset( textX, textY );
imageNode.setOffset( imageX, imageY );
return content;
}