本文整理汇总了Java中org.netbeans.api.visual.widget.Widget.getPreferredLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Widget.getPreferredLocation方法的具体用法?Java Widget.getPreferredLocation怎么用?Java Widget.getPreferredLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.visual.widget.Widget
的用法示例。
在下文中一共展示了Widget.getPreferredLocation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setResolvedNodeLocation
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
* Should be called to set a new resolved preferred location of a node.
* @param graph the universal graph
* @param node the node with resolved location
* @param newPreferredLocation the new resolved location
*/
protected final void setResolvedNodeLocation (UniversalGraph<N,E> graph, N node, Point newPreferredLocation) {
ObjectScene scene = graph.getScene ();
Widget widget = scene.findWidget (node);
if (widget == null)
return;
Point previousPreferredLocation = widget.getPreferredLocation ();
if (animated)
scene.getSceneAnimator ().animatePreferredLocation (widget, newPreferredLocation);
else
widget.setPreferredLocation (newPreferredLocation);
GraphLayoutListener<N,E>[] listeners = createListenersCopy ();
for (GraphLayoutListener<N,E> listener : listeners)
listener.nodeLocationChanged (graph, node, previousPreferredLocation, newPreferredLocation);
}
示例2: VertexWrapper
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
this.node = node;
this.graph = graph;
final VertexWrapper vertex = this;
this.slot = new Port() {
public Vertex getVertex() {
return vertex;
}
public Point getRelativePosition() {
return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
}
};
Widget w = graph.getScene().findWidget(node);
this.position = w.getPreferredLocation();
}
示例3: tick
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
protected void tick (double progress) {
for (Map.Entry<Widget, Point> entry : targetLocations.entrySet ()) {
Widget widget = entry.getKey ();
Point sourceLocation = sourceLocations.get (widget);
if (sourceLocation == null) {
sourceLocation = widget.getPreferredLocation ();
if (sourceLocation == null) {
sourceLocation = widget.getLocation ();
if (sourceLocation == null) {
sourceLocation = new Point ();
}
}
sourceLocations.put (widget, sourceLocation);
}
Point targetLocation = entry.getValue ();
if (targetLocation == null)
continue;
Point point;
if (progress >= 1.0)
point = targetLocation;
else
point = new Point (
(int) (sourceLocation.x + progress * (targetLocation.x - sourceLocation.x)),
(int) (sourceLocation.y + progress * (targetLocation.y - sourceLocation.y)));
widget.setPreferredLocation (point);
}
if (progress >= 1.0) {
sourceLocations.clear ();
targetLocations.clear ();
}
}
示例4: 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);
}
示例5: setNewLocation
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void setNewLocation(Widget widget, Point location) {
if (selection.contains(widget)) {
// move entire selection
Point originalLocation = getOriginalLocation(widget);
int xOffset = location.x - originalLocation.x;
int yOffset = location.y - originalLocation.y;
for (Widget w : selection) {
Point p = new Point(w.getPreferredLocation());
p.translate(xOffset, yOffset);
w.setPreferredLocation(p);
}
} else {
widget.setPreferredLocation(location);
}
}
示例6: getOriginalLocation
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
@Override public Point getOriginalLocation(Widget widget) {
return widget.getPreferredLocation ();
}
示例7: getOriginalLocation
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public Point getOriginalLocation (Widget widget) {
return widget.getPreferredLocation ();
}
示例8: getOriginalLocation
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public Point getOriginalLocation(Widget widget) {
return widget.getPreferredLocation();
}