本文整理汇总了Java中edu.umd.cs.piccolo.PNode.getVisible方法的典型用法代码示例。如果您正苦于以下问题:Java PNode.getVisible方法的具体用法?Java PNode.getVisible怎么用?Java PNode.getVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.PNode
的用法示例。
在下文中一共展示了PNode.getVisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDragHandle
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private static void updateDragHandle( PNode dragHandleNode, final double barHeight, final double graphHeight ) {
// handles are invisible if the bar extends above or below the graph's bounds
dragHandleNode.setVisible( barHeight > 0 && barHeight <= graphHeight );
if ( dragHandleNode.getVisible() ) {
// position the handle at the top of the bar
dragHandleNode.setOffset( dragHandleNode.getXOffset(), graphHeight - barHeight );
}
}
示例2: updateButtonsLayout
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateButtonsLayout() {
// arrange all visible buttons in a row
double x = 0;
double y = 0;
double buttonMaxX = 0;
double buttonMaxY = 0;
for ( int i = 0; i < buttonsParentNode.getChildrenCount(); i++ ) {
PNode child = buttonsParentNode.getChild( i );
if ( child.getVisible() ) {
child.setOffset( x, y );
x += child.getFullBoundsReference().getWidth() + BUTTON_X_SPACING;
buttonMaxX = child.getFullBoundsReference().getMaxX();
buttonMaxY = child.getFullBoundsReference().getMaxY();
}
}
// put visible buttons at bottom center of the proper box
Point2D offset = null;
if ( model.getChallenge().getChallengeType() == ChallengeType.AFTER ) {
offset = afterNode.getOffset();
}
else {
offset = beforeNode.getOffset();
}
x = offset.getX() + ( ( BOX_SIZE.getWidth() - buttonMaxX ) / 2 );
y = offset.getY() + BOX_SIZE.getHeight() - buttonMaxY - 10;
buttonsParentNode.setOffset( x, y );
}
示例3: isNodeVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Determines if a node is visible.
* A node is visible if it and and all of its ancestors is visible.
*
* @param node
* @return true or value
*/
public static boolean isNodeVisible( final PNode node ) {
boolean visible = node.getVisible();
PNode aNode = node;
while ( visible && aNode != null ) {
aNode = aNode.getParent();
if ( aNode != null ) {
visible = aNode.getVisible();
}
}
return visible;
}