當前位置: 首頁>>代碼示例>>Java>>正文


Java Point.clone方法代碼示例

本文整理匯總了Java中java.awt.Point.clone方法的典型用法代碼示例。如果您正苦於以下問題:Java Point.clone方法的具體用法?Java Point.clone怎麽用?Java Point.clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Point的用法示例。


在下文中一共展示了Point.clone方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showPopupAtMousePosition

import java.awt.Point; //導入方法依賴的package包/類
private void showPopupAtMousePosition() {
	// StaticDebug.debug("DND POPUP: Show popup at Mouse position");
	// get mouse location
	Point screenLocation = MouseInfo.getPointerInfo().getLocation();
	screenLocation.x += 26;
	screenLocation.y += 10;

	// if tooltip is shown
	if (tipWindow != null) {
		// StaticDebug.debug("DND POPUP: Popup is already shown");

		// check if mouse has moved
		if (mouseX != screenLocation.x || mouseY != screenLocation.y) {
			// StaticDebug.debug("DND POPUP: old position x = "+mouseX);
			// StaticDebug.debug("DND POPUP: old position y = "+mouseY);
			// StaticDebug.debug("DND POPUP: new position x = "+screenLocation.x);
			// StaticDebug.debug("DND POPUP: new position y = "+screenLocation.y);
			// StaticDebug.debug("DND POPUP: Mouse position has changed.. hide popup first");
			// hide tooltip
			hideDropDeniedTooltip();
		} else {
			// StaticDebug.debug("DND POPUP: Restart hide timer to prevent popup from being hidden.");
			// otherwise restart hide timer
			hideTimer.restart();
			return;
		}
	}

	Point componentLocation = (Point) screenLocation.clone();
	SwingUtilities.convertPointFromScreen(componentLocation, popupSource);
	if (tipWindow == null && popupSource.contains(componentLocation)) {
		// StaticDebug.debug("DND POPUP: Mouse is inside popupSource and popup is not shown");
		JToolTip tip = popupSource.createToolTip();
		tip.setTipText(reason);
		PopupFactory popupFactory = PopupFactory.getSharedInstance();

		mouseX = screenLocation.x;
		mouseY = screenLocation.y;

		// StaticDebug.debug("DND POPUP: show popup at "+mouseX+","+mouseY+" and start hide timer");
		tipWindow = popupFactory.getPopup(popupSource, tip, mouseX, mouseY);
		tipWindow.show();
		hideTimer.restart();
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:46,代碼來源:AbstractPatchedTransferHandler.java

示例2: getLocation

import java.awt.Point; //導入方法依賴的package包/類
public static Point getLocation(Window win) {
	Point ret = frameLocations.get(win);
	return ret == null ? null : (Point) ret.clone();
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:5,代碼來源:Projects.java

示例3: Bomb

import java.awt.Point; //導入方法依賴的package包/類
Bomb(Point p){
	position = (Point) p.clone();
}
 
開發者ID:bela127,項目名稱:genetic-algorithm,代碼行數:4,代碼來源:Bomb.java

示例4: Player

import java.awt.Point; //導入方法依賴的package包/類
Player(Point p){
	position = (Point) p.clone();
}
 
開發者ID:bela127,項目名稱:genetic-algorithm,代碼行數:4,代碼來源:Player.java

示例5: Zombie

import java.awt.Point; //導入方法依賴的package包/類
Zombie(Point p){
	position = (Point) p.clone();
}
 
開發者ID:bela127,項目名稱:genetic-algorithm,代碼行數:4,代碼來源:Zombie.java

示例6: setDestinationOffset

import java.awt.Point; //導入方法依賴的package包/類
/**
 * Specifies the offset in the destination image at which future
 * decoded pixels are to be placed, when reading, or where a
 * region will be written, when writing.
 *
 * <p> When reading, the region to be written within the
 * destination <code>BufferedImage</code> will start at this
 * offset and have a width and height determined by the source
 * region of interest, the subsampling parameters, and the
 * destination bounds.
 *
 * <p> Normal writes are not affected by this method, only writes
 * performed using <code>ImageWriter.replacePixels</code>.  For
 * such writes, the offset specified is within the output stream
 * image whose pixels are being modified.
 *
 * <p> There is no <code>unsetDestinationOffset</code> method;
 * simply call <code>setDestinationOffset(new Point(0, 0))</code> to
 * restore default values.
 *
 * @param destinationOffset the offset in the destination, as a
 * <code>Point</code>.
 *
 * @exception IllegalArgumentException if
 * <code>destinationOffset</code> is <code>null</code>.
 *
 * @see #getDestinationOffset
 * @see ImageWriter#replacePixels
 */
public void setDestinationOffset(Point destinationOffset) {
    if (destinationOffset == null) {
        throw new IllegalArgumentException("destinationOffset == null!");
    }
    this.destinationOffset = (Point)destinationOffset.clone();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:36,代碼來源:IIOParam.java

示例7: setDestinationOffset

import java.awt.Point; //導入方法依賴的package包/類
/**
 * Specifies the offset in the destination image at which future
 * decoded pixels are to be placed, when reading, or where a
 * region will be written, when writing.
 *
 * <p> When reading, the region to be written within the
 * destination {@code BufferedImage} will start at this
 * offset and have a width and height determined by the source
 * region of interest, the subsampling parameters, and the
 * destination bounds.
 *
 * <p> Normal writes are not affected by this method, only writes
 * performed using {@code ImageWriter.replacePixels}.  For
 * such writes, the offset specified is within the output stream
 * image whose pixels are being modified.
 *
 * <p> There is no {@code unsetDestinationOffset} method;
 * simply call {@code setDestinationOffset(new Point(0, 0))} to
 * restore default values.
 *
 * @param destinationOffset the offset in the destination, as a
 * {@code Point}.
 *
 * @exception IllegalArgumentException if
 * {@code destinationOffset} is {@code null}.
 *
 * @see #getDestinationOffset
 * @see ImageWriter#replacePixels
 */
public void setDestinationOffset(Point destinationOffset) {
    if (destinationOffset == null) {
        throw new IllegalArgumentException("destinationOffset == null!");
    }
    this.destinationOffset = (Point)destinationOffset.clone();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:IIOParam.java


注:本文中的java.awt.Point.clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。