当前位置: 首页>>代码示例>>Java>>正文


Java Widget.getPreferredBounds方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ResizeAction.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:TreeGraphLayout.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ConnectionWidgetLayout.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:TreeGraphLayout.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:TreeGraphLayout.java


注:本文中的org.netbeans.api.visual.widget.Widget.getPreferredBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。