本文整理汇总了Java中org.netbeans.api.visual.widget.Widget.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Widget.isVisible方法的具体用法?Java Widget.isVisible怎么用?Java Widget.isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.visual.widget.Widget
的用法示例。
在下文中一共展示了Widget.isVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layout
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void layout (Widget widget) {
Collection<Widget> children = widget.getChildren ();
for (Widget child : children) {
if (child.isVisible ())
child.resolveBounds (child.getPreferredLocation (), null);
else
child.resolveBounds (null, new Rectangle ());
}
}
示例2: justify
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void justify (Widget widget) {
Rectangle clientArea = widget.getClientArea ();
for (Widget child : widget.getChildren ()) {
if (child.isVisible ()) {
Point location = child.getPreferredBounds ().getLocation ();
child.resolveBounds (new Point (clientArea.x - location.x, clientArea.y - location.y), new Rectangle (location, clientArea.getSize ()));
} else {
child.resolveBounds (clientArea.getLocation (), new Rectangle ());
}
}
}
示例3: countNodeIntersections
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private int countNodeIntersections(Collection<Widget> nodeWidgets, Line2D... lines){
int count=0;
for(Widget nw : nodeWidgets){
if(nw.isVisible()) {
Rectangle bounds = nw.convertLocalToScene(nw.getBounds());
for( Line2D line : lines){
if(line.intersects(bounds))
count++;
}
}
}
return count;
}
示例4: intersects
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private boolean intersects(Collection<Widget> nodeWidgets, Point start, Point end) {
List<Point> pointlist = new ArrayList<>();
pointlist.add(start);
pointlist.add(end);
for(Widget w : nodeWidgets){
if(w.isVisible() && intersects(w, pointlist)) {
return true;
}
}
return false;
}
示例5: layout
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void layout (Widget widget) {
ConnectionWidget connectionWidget = (ConnectionWidget) widget;
connectionWidget.calculateRouting ();
java.util.List<Point> controlPoints = connectionWidget.getControlPoints ();
boolean empty = controlPoints == null || controlPoints.size () <= 0;
double totalDistance = 0.0;
double[] distances = new double[empty ? 0 : controlPoints.size () - 1];
for (int i = 0; i < distances.length; i ++)
distances[i] = totalDistance += GeomUtil.distanceSq (controlPoints.get (i), controlPoints.get (i + 1));
ArrayList<Widget> childrenToResolve = new ArrayList<Widget> (widget.getChildren());
for (Map.Entry<Placement,ArrayList<Widget>> entry : reverse.entrySet()) {
Placement placement = entry.getKey ();
ArrayList<Widget> currentlyResolving = null;
for (Widget childWidget : entry.getValue()) {
if (childWidget.getParentWidget() == widget && childWidget.isVisible()) {
if (currentlyResolving == null)
currentlyResolving = new ArrayList<Widget>();
currentlyResolving.add(childWidget);
}
}
if (currentlyResolving == null)
continue;
Point point;
if (empty) {
point = new Point();
} else if (placement.isPercentage) {
float percentage = placement.placementInPercentage;
if (percentage <= 0.0)
point = connectionWidget.getFirstControlPoint ();
else if (percentage >= 1.0)
point = connectionWidget.getLastControlPoint ();
else
point = getLinePointAtPercentage (distances, (int) (percentage * totalDistance), controlPoints);
} else {
int distance = placement.placementAtDistance;
if (distance < 0)
point = getLinePointAtPercentage (distances, distance + (int) totalDistance, controlPoints);
else
point = getLinePointAtPercentage (distances, distance, controlPoints);
}
layoutChildrenAt (point, placement.alignment, connectionWidget, currentlyResolving);
childrenToResolve.removeAll (currentlyResolving);
}
if (! childrenToResolve.isEmpty())
layoutChildrenAt (new Point (), null, connectionWidget, childrenToResolve);
}