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


Java Point.getY方法代码示例

本文整理汇总了Java中java.awt.Point.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Point.getY方法的具体用法?Java Point.getY怎么用?Java Point.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Point的用法示例。


在下文中一共展示了Point.getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPointOnSegment

import java.awt.Point; //导入方法依赖的package包/类
private Point getPointOnSegment(Point p0, Point p1, double distanceFromP0) {
	/*if the given points are on the same x or y coord, calculate resulting point in a more
	efficient way*/
	if (p0.getX() == p1.getX()) {
		if (p0.y <= p1.y) {
			return new Point((int) p0.getX(), (int) (p0.getY() + distanceFromP0));
		} else {
			return new Point((int) p0.getX(), (int) (p0.getY() - distanceFromP0));
		}
	}
	if (p0.getY() == p1.getY()) {
		if (p0.x <= p1.x) {
			return new Point((int) (p0.getX() + distanceFromP0), (int) p0.getY());
		} else {
			return new Point((int) (p0.getX() - distanceFromP0), (int) p0.getY());
		}
	}
	//else calculate a more accurate position
	double euclDist = getEuclideanDistance(p0, p1);
	int xDist = (int) (((p1.getX() - p0.getX()) * distanceFromP0) / euclDist);
	int yDist = (int) (((p1.getY() - p0.getY()) * distanceFromP0) / euclDist);
	return new Point(xDist + (int) p0.getX(), yDist + (int) p0.getY());
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:24,代码来源:EdgeAnimation.java

示例2: refresh

import java.awt.Point; //导入方法依赖的package包/类
/**Refreshes appearence of the image to be rendered. In facts, recalculates all of the jobs'
 * new positions.*/
public void refresh() {
	for (int i = 0; i < jobAnimations.size(); i++) {
		JobAnimation ja = jobAnimations.get(i);
		//update position as time*speed
		ja.setPosition((System.currentTimeMillis() - ja.getTimeOfEntrance()) * ja.getSpeed());
		Point p = convertPositionToCoord(ja.getPosition());
		//tests if this job should be painted outside bounding box of this edge
		if (p != null) {
			boolean exceedsWidth = (p.getX() >= bounds.x + bounds.width), exceedsHeight = (p.getY() >= bounds.y + bounds.height);
			if (exceedsWidth || exceedsHeight) {
				routeJob(ja);
			}
			//set bounds of the job in order to be centered to the coords.
			Rectangle r = ja.getBounds();
			p.setLocation(p.getX() - r.getWidth() / 2, p.getY() - r.getHeight() / 2);
			r.setLocation(p);
		} else {
			routeJob(ja);
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:24,代码来源:EdgeAnimation.java

示例3: doZoom

import java.awt.Point; //导入方法依赖的package包/类
public void doZoom( Point p, double factor ) {
Rectangle rect = getVisibleRect();
double x = p.getX() / zoom;
		double y = p.getY() / zoom;
		double w = rect.getWidth();
		double h = rect.getHeight();
		zoom *= factor;
		int newX = (int) (x*zoom - w*.5d);
		int newY = (int) (y*zoom - h*.5d);
		invalidate();
		scrollPane.validate();
		JScrollBar sb = scrollPane.getHorizontalScrollBar();
		sb.setValue(newX);
		sb = scrollPane.getVerticalScrollBar();
		sb.setValue(newY);
		repaint();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:18,代码来源:SCSImage.java

示例4: insidePoint

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Set the parameter point as the dragPoint. If the point in out of the
 * graphich area it is resized
 * @param p The point
 */
public Point insidePoint(Point p) {
	int x = (int) p.getX();
	int y = (int) p.getY();

	//Resize x and y if they are too big or too small
	if (x < tran_x) {
		Math.max(x = tran_x, 0);
	}
	if (x > (tran_x + (int) (maxValue * scale))) {
		x = (tran_x + (int) (maxValue * scale));
	}
	if (y > tran_y) {
		Math.max(y = tran_y, 0);
	}
	if (y < (tran_y - (int) (maxValue * scale))) {
		y = (tran_y - (int) (maxValue * scale));
	}
	return new Point(x, y);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:25,代码来源:PainterConvex2D.java

示例5: getCenterPoint

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Returns the center point of a shape.
 */

public Point getCenterPoint(final List<Point> points) {

  int centerX = 0;
  int centerY = 0;

  for (Point p : points) {
    centerX += p.getX();
    centerY += p.getY();
  }

  return new Point(centerX / points.size(), centerY / points.size());
}
 
开发者ID:zubairfarahi,项目名称:MiniCAD,代码行数:17,代码来源:ShapeDrawVisitor.java

示例6: layoutCirculary

import java.awt.Point; //导入方法依赖的package包/类
private void layoutCirculary(Collection<GraphNode<I>> nodes, GraphNode<I> masterNode) {
    Point masterPoint = new Point();
    NodeWidget master = getWidget(masterNode);
    masterPoint.setLocation(master.locX, master.locY);
    double r;
    double theta;
    double thetaStep = Math.PI / 5;
    r = 150;
    theta = 0;
    Iterator<GraphNode<I>> it = nodes.iterator();
    NodeWidget nw = getWidget(it.next());
    while (true) {
        AffineTransform tr = AffineTransform.getRotateInstance(theta);
        Point2D d2point = tr.transform(new Point2D.Double(0, r), null);
        Point point = new Point((int)d2point.getX() + masterPoint.x, (int)d2point.getY() + masterPoint.y);
        if (isThereFreeSpace(point, nw)) {
            nw.locX = point.getX();
            nw.locY = point.getY();
            nw.dispX = 0;
            nw.dispY = 0;
            if (it.hasNext()) {
                nw = getWidget(it.next());
            } else {
                return;
            }
        }
        theta = theta + thetaStep;
        if (theta > (Math.PI * 2 - Math.PI / 10)) {
            r = r + 90;
            theta = theta - Math.PI * 2;
            thetaStep = thetaStep * 3 / 4; 
        }
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:FruchtermanReingoldLayout.java

示例7: showPropertyInteractionWindow

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Shows a property interaction window for the given component.
 * @param component the component whose properties will be shown
 * @param pos the position in which the window will be shown
 */
public void showPropertyInteractionWindow(GraphComponent component,Point pos) {
	if (component != null) {
		PropertyInteractionDialog window = new PropertyInteractionDialog((int)pos.getX(),(int)pos.getY(),graph,component);
		window.setVisible(true);
	}
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:12,代码来源:UIFacade.java

示例8: refreshIfMouseOutside

import java.awt.Point; //导入方法依赖的package包/类
private void refreshIfMouseOutside(Point pt) {
    mousePoint = (int)pt.getY();
    if (LOG.isLoggable(Level.FINEST)) {
        if (mouseBoundary == null) {
            LOG.log(Level.FINEST, "Mouse boundary not set, refreshing: {0}", mousePoint);
        } else {
            LOG.log(Level.FINEST, "Mouse {0} inside known mouse boundary: {1}-{2}", 
                    new Object[] { mousePoint, mouseBoundary.y, mouseBoundary.getMaxY() });
        }
    }
    if (mouseBoundary == null || mousePoint < mouseBoundary.y || mousePoint > mouseBoundary.getMaxY()) {
        refresh();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CodeFoldingSideBar.java

示例9: translateScreenToJava2D

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Translates a panel (component) location to a Java2D point.
 * 
 * @param screenPoint
 *            the screen location (<code>null</code> not permitted).
 * 
 * @return The Java2D coordinates.
 */

@Override
public Point2D translateScreenToJava2D(Point screenPoint) {
	Insets insets = getInsets();
	double x = (screenPoint.getX() - insets.left) / this.scaleX;
	double y = (screenPoint.getY() - insets.top) / this.scaleY;
	return new Point2D.Double(x, y);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:AbstractChartPanel.java

示例10: scrollNow

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Start scrolling.
 */
private void scrollNow() {
	if (mouseOnScreenPoint != null && target.isShowing()) {
		Point origin = target.getLocationOnScreen();
		Point relative = new Point(mouseOnScreenPoint.x - origin.x, mouseOnScreenPoint.y - origin.y);

		Rectangle visibleRect = target.getVisibleRect();

		if (!visibleRect.contains(relative)) {
			int destX = relative.x;
			if (relative.getX() < visibleRect.getMinX()) {
				destX = (int) visibleRect.getMinX() - PAN_STEP_SIZE;
			}
			if (relative.getX() > visibleRect.getMaxX()) {
				destX = (int) visibleRect.getMaxX() + PAN_STEP_SIZE;
			}

			int destY = relative.y;
			if (relative.getY() < visibleRect.getMinY()) {
				destY = (int) visibleRect.getMinY() - PAN_STEP_SIZE;
			}
			if (relative.getY() > visibleRect.getMaxY()) {
				destY = (int) visibleRect.getMaxY() + PAN_STEP_SIZE;
			}

			target.scrollRectToVisible(new Rectangle(new Point(destX, destY)));
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:PanningManager.java

示例11: toProcessSpace

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Converts a {@link Point} to a point relative to the specified process.
 *
 * @param p
 *            the original point
 * @param processIndex
 *            the index of the process
 * @return the relative point or {@code null} if no process exists for the specified index
 */
public Point toProcessSpace(final Point p, final int processIndex) {
	int xOffset = 0;
	for (int i = 0; i < model.getProcesses().size(); i++) {
		xOffset += ProcessDrawer.WALL_WIDTH;
		if (i == processIndex) {
			return new Point((int) p.getX() - xOffset, (int) p.getY() - ProcessDrawer.PADDING);
		}
		xOffset += ProcessDrawer.WALL_WIDTH + model.getProcessWidth(model.getProcess(i));
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ProcessRendererView.java

示例12: mouseDragged

import java.awt.Point; //导入方法依赖的package包/类
/**
 * 
 */
public void mouseDragged(MouseEvent e)
{
	if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
			&& first != null)
	{
		mxRectangle dirty = mxUtils.getBoundingBox(currentState,
				currentAngle * mxConstants.DEG_PER_RAD);
		Point pt = SwingUtilities.convertPoint(e.getComponent(),
				e.getPoint(), graphComponent.getGraphControl());

		double cx = currentState.getCenterX();
		double cy = currentState.getCenterY();
		double dx = pt.getX() - cx;
		double dy = pt.getY() - cy;
		double c = Math.sqrt(dx * dx + dy * dy);

		currentAngle = ((pt.getX() > cx) ? -1 : 1) * Math.acos(dy / c)
				+ PI4 + initialAngle;

		dirty.add(mxUtils.getBoundingBox(currentState, currentAngle
				* mxConstants.DEG_PER_RAD));
		dirty.grow(1);

		// TODO: Compute dirty rectangle and repaint
		graphComponent.getGraphControl().repaint(dirty.getRectangle());
		e.consume();
	}
	else if (handle.getParent() != null)
	{
		handle.getParent().remove(handle);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:36,代码来源:mxRotationHandler.java

示例13: convertToAbsoluteProcessPoint

import java.awt.Point; //导入方法依赖的package包/类
/**
 * Returns the absolute point for a given point in a process.
 *
 * @param p
 *            the relative point which is relative to the displayed process
 * @param processIndex
 *            the index of the process in question
 * @param model
 *            the model required to calculate the absolute location
 * @return the absolute point (relative to the process renderer view) or {@code null} if the
 *         process index is invalid
 */
public static Point convertToAbsoluteProcessPoint(final Point p, final int processIndex,
		final ProcessRendererModel model) {
	double xOffset = 0;
	for (int i = 0; i < model.getProcesses().size(); i++) {
		xOffset += ProcessDrawer.WALL_WIDTH;
		if (i == processIndex) {
			return new Point((int) (p.getX() + xOffset), (int) (p.getY() + ProcessDrawer.PADDING));
		}
		xOffset += ProcessDrawer.WALL_WIDTH + model.getProcessWidth(model.getProcess(i));
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:ProcessDrawUtils.java

示例14: getObjectLocation

import java.awt.Point; //导入方法依赖的package包/类
@Override
protected Point getObjectLocation() {
	// get all necessary parameters
	if (!getDockable().getComponent().isShowing()) {
		return new Point(0, 0);
	}

	Point rendererLoc = renderer.getVisibleRect().getLocation();
	Rectangle2D targetRect = renderer.getModel().getOperatorRect(operator);
	if (targetRect == null) {
		return rendererLoc;
	}
	Point loc = new Point((int) targetRect.getX(), (int) targetRect.getY());
	loc = ProcessDrawUtils.convertToAbsoluteProcessPoint(loc,
			renderer.getModel().getProcessIndex(operator.getExecutionUnit()), renderer.getModel());
	if (loc == null) {
		return rendererLoc;
	}

	// calculate actual on screen loc of the operator and return it

	Point absoluteLoc = new Point((int) (viewport.getLocationOnScreen().x + (loc.getX() - rendererLoc.getX())),
			(int) (viewport.getLocationOnScreen().y + (loc.getY() - rendererLoc.getY())));

	// return validated Point
	return this.validatePointForBubbleInViewport(absoluteLoc);

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:OperatorInfoBubble.java

示例15: getObjectLocation

import java.awt.Point; //导入方法依赖的package包/类
@Override
protected Point getObjectLocation() {
	// get all necessary parameters
	if (!getDockable().getComponent().isShowing()) {
		return new Point(0, 0);
	}

	Point portLoc = ProcessDrawUtils.createPortLocation(port, renderer.getModel());
	if (portLoc == null) {
		return null;
	}
	portLoc = ProcessDrawUtils.convertToAbsoluteProcessPoint(portLoc,
			renderer.getModel().getProcessIndex(port.getPorts().getOwner().getConnectionContext()), renderer.getModel());
	if (portLoc == null) {
		return null;
	}
	portLoc.translate(-getObjectWidth() / 2, -getObjectHeight() / 2);

	// calculate actual on screen loc of the port loc and return it
	Point rendererLoc = renderer.getVisibleRect().getLocation();
	Point absoluteLoc = new Point((int) (viewport.getLocationOnScreen().x + (portLoc.getX() - rendererLoc.getX())),
			(int) (viewport.getLocationOnScreen().y + (portLoc.getY() - rendererLoc.getY())));

	// return validated Point
	return this.validatePointForBubbleInViewport(absoluteLoc);

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:PortInfoBubble.java


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