List of usage examples for java.awt Point toString
public String toString()
From source file:Main.java
public static void main(String[] args) { Point p = new Point(); System.out.println(p.toString()); }
From source file:Main.java
public static void main(String[] args) { Point p = new Point(); p.setLocation(2, 3);/*from w w w. jav a 2 s . c o m*/ System.out.println(p.toString()); }
From source file:Main.java
public static void main(String[] args) { Point p = new Point(); p.setLocation(2.3D, 3.3D);/*from w w w . j a v a 2 s .c om*/ System.out.println(p.toString()); }
From source file:Main.java
public static void main(String[] args) { Point p = new Point(); p.setLocation(new Point(2, 3)); System.out.println(p.toString()); }
From source file:com.willwinder.universalgcodesender.model.GUIBackend.java
private void keepAwake() { logger.log(Level.INFO, "Moving the mouse location slightly to keep the computer awake."); try {//from w w w. j av a 2 s. co m Robot hal = new Robot(); Point pObj = MouseInfo.getPointerInfo().getLocation(); hal.mouseMove(pObj.x + 1, pObj.y + 1); hal.mouseMove(pObj.x - 1, pObj.y - 1); pObj = MouseInfo.getPointerInfo().getLocation(); logger.log(Level.INFO, pObj.toString() + "x>>" + pObj.x + " y>>" + pObj.y); } catch (AWTException | NullPointerException ex) { Logger.getLogger(GUIBackend.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.safs.selenium.webdriver.CFComponent.java
/** * perform LeftDrag or RightDrag on component moving from (x1,y1) to (x2,y2). * Format: "T,SwingApp,component,LeftDrag,"Coords=x1;y1;x2;y2" * @exception SAFSException//from w ww. j a v a2 s . c om */ protected void performDrag() throws SAFSException { String debugInf = StringUtils.debugmsg(false); if (params.size() < 1) { paramsFailedMsg(windowName, compName); return; } try { //format of preset: Coords=0,0,640,480 String preset = (String) params.iterator().next(); preset = getPossibleMapItem(preset); Polygon polygon = StringUtils.convertLine(preset); Point p1 = new java.awt.Point(polygon.xpoints[0], polygon.ypoints[0]); Point p2 = new java.awt.Point(polygon.xpoints[1], polygon.ypoints[1]); String msg = " :" + action + " from " + p1.toString() + " to " + p2.toString(); if (action.equalsIgnoreCase(LEFTDRAG)) { WDLibrary.leftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(SHIFTLEFTDRAG)) { WDLibrary.shiftLeftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(CTRLSHIFTLEFTDRAG)) { WDLibrary.ctrlShiftLeftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(CTRLLEFTDRAG)) { WDLibrary.ctrlLeftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(ALTLEFTDRAG)) { WDLibrary.altLeftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(CTRLALTLEFTDRAG)) { WDLibrary.ctrlAltLeftDrag(compObject, p1, p2); } else if (action.equalsIgnoreCase(RIGHTDRAG)) { WDLibrary.rightDrag(compObject, p1, p2); } testRecordData.setStatusCode(StatusCodes.OK); log.logMessage(testRecordData.getFac(), genericText.convert(TXT_SUCCESS_4, altText + msg, windowName, compName, action, msg), PASSED_MESSAGE); } catch (Exception e) { Log.debug(debugInf + e.getMessage()); testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE); componentFailureMessage(e.getMessage()); } }
From source file:org.safs.selenium.webdriver.CFComponent.java
/** * perform dragTo from component1 to component2 with offset. * @exception SAFSException/*from w ww .j av a 2 s. c o m*/ */ protected void dragTo() throws SAFSException { String debugmsg = StringUtils.debugmsg(false); if (params.size() < 2) { paramsFailedMsg(windowName, compName); return; } try { String toWindow = (String) iterator.next(); String toComponent = (String) iterator.next(); IndependantLog.debug(debugmsg + "Source component is '" + windowName + ":" + compName + "'"); IndependantLog.debug(debugmsg + "Before getting target component '" + toWindow + ":" + toComponent + "'," + "\n TestRecordData: winrec=" + testRecordData.getWindowGuiId() + "; comprec=" + testRecordData.getCompGuiId()); //BE CAREFUL!!! This calling (wdUtils.getTestObject) may change the testRecordData object, which will contain information of the target component!!! WebElement toElement = wdUtils.getTestObject(mapname, toWindow, toComponent, true); IndependantLog.debug(debugmsg + "After getting target component '" + toWindow + ":" + toComponent + "'," + "\n TestRecordData: winrec=" + testRecordData.getWindowGuiId() + "; comprec=" + testRecordData.getCompGuiId()); //offset String offset = "50%, 50%, 50%, 50%"; if (iterator.hasNext()) { offset = (String) iterator.next(); offset = getPossibleMapItem(offset); } IndependantLog.debug(debugmsg + " offset is " + offset); String[] offsetArray = StringUtils.convertCoordsToArray(offset, 4); if (offsetArray == null) { throw new SAFSParamException(" Offset '" + offset + "' is not valid! The valid examples could be '20%,10%,%50,%60', '30,55,70,80', or even '20%,10%,70,80'."); } Point p1 = WDLibrary.getElementOffsetScreenLocation(compObject, offsetArray[0], offsetArray[1]); Point p2 = WDLibrary.getElementOffsetScreenLocation(toElement, offsetArray[2], offsetArray[3]); if (action.equalsIgnoreCase(GenericObjectFunctions.DRAGTO_KEYWORD)) { Robot.leftDrag(p1, p2); } else { throw new SAFSException("Not supported yet.", SAFSException.CODE_ACTION_NOT_SUPPORTED); } String msg = " :" + action + " from " + p1.toString() + " to " + p2.toString(); testRecordData.setStatusCode(StatusCodes.OK); log.logMessage(testRecordData.getFac(), genericText.convert(TXT_SUCCESS_4, altText + msg, windowName, compName, action, msg), PASSED_MESSAGE); } catch (Exception e) { String errorMsg = "Met " + StringUtils.debugmsg(e); IndependantLog.error(debugmsg + errorMsg); testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE); componentFailureMessage(errorMsg); } }