本文整理汇总了Java中org.netbeans.api.visual.widget.Widget.getPreferredBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Widget.getPreferredBounds方法的具体用法?Java Widget.getPreferredBounds怎么用?Java Widget.getPreferredBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.visual.widget.Widget
的用法示例。
在下文中一共展示了Widget.getPreferredBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public State mousePressed (Widget widget, WidgetMouseEvent event) {
if (isLocked ())
return State.createLocked (widget, this);
if (event.getButton () == MouseEvent.BUTTON1 && event.getClickCount () == 1) {
insets = widget.getBorder ().getInsets ();
controlPoint = resolver.resolveControlPoint (widget, event.getPoint ());
if (controlPoint != null) {
resizingWidget = widget;
originalSceneRectangle = null;
if (widget.isPreferredBoundsSet ())
originalSceneRectangle = widget.getPreferredBounds ();
if (originalSceneRectangle == null)
originalSceneRectangle = widget.getBounds ();
if (originalSceneRectangle == null)
originalSceneRectangle = widget.getPreferredBounds ();
dragSceneLocation = widget.convertLocalToScene (event.getPoint ());
provider.resizingStarted (widget);
return State.createLocked (widget, this);
}
}
return State.REJECTED;
}
示例2: calculateMaxSpace
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
* Method to determine the maximal space (horizontaly or verticaly) of each level in the tree.
* @param map the {@link Map} to which the maximal space for each level should be stored.
* @param lvl the level to analyse.
* @return the result of the maximal space calculation for the given level and the sublevels.
* @since 2.25
*/
private Map<Integer, Integer> calculateMaxSpace(UniversalGraph<N, E> graph, Map<Integer, Integer> map, int lvl) {
Widget widget = graph.getScene().findWidget(node);
widget.getLayout().layout(widget);
relativeBounds = widget.getPreferredBounds();
if (vertical) {
space = relativeBounds.height;
} else {
space = relativeBounds.width;
}
if (map.get(lvl) != null) {
// lvl is in list, but height is greater than the old one.
if (map.get(lvl) < space) {
map.put(lvl, space);
}
} else {
// lvl isn't in the map right now.
map.put(lvl, space);
}
lvl++;
// do iteration over all children of the current node and calculate
// the maxSpace
for (Node n : children) {
n.calculateMaxSpace(graph, map, lvl);
}
return map;
}
示例3: layoutSingleChildAt
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private void layoutSingleChildAt (Point linePoint, ConnectionWidgetLayoutAlignment alignment, ConnectionWidget connectionWidget, Widget childWidget) {
Rectangle preferredBounds = childWidget.getPreferredBounds ();
Point referencePoint = getReferencePointForAdjustedAlignment (alignment, preferredBounds);
Point location = childWidget.getPreferredLocation ();
if (location != null)
referencePoint.translate (-location.x, -location.y);
childWidget.resolveBounds (new Point (linePoint.x - referencePoint.x, linePoint.y - referencePoint.y), preferredBounds);
}
示例4: allocateHorizontally
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private int allocateHorizontally () {
Widget widget = scene.findWidget (node);
widget.getLayout ().layout (widget);
relativeBounds = widget.getPreferredBounds ();
space = 0;
for (int i = 0; i < children.size (); i++) {
if (i > 0)
space += horizontalGap;
space += children.get (i).allocateHorizontally ();
}
totalSpace = Math.max (space, relativeBounds.width);
return totalSpace;
}
示例5: allocateVertically
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private int allocateVertically () {
Widget widget = scene.findWidget (node);
widget.getLayout ().layout (widget);
relativeBounds = widget.getPreferredBounds ();
space = 0;
for (int i = 0; i < children.size (); i++) {
if (i > 0)
space += verticalGap;
space += children.get (i).allocateVertically ();
}
totalSpace = Math.max (space, relativeBounds.height);
return totalSpace;
}