List of usage examples for java.awt Rectangle contains
public boolean contains(Rectangle r)
From source file:org.safs.selenium.webdriver.lib.WDLibrary.java
/** * Check if the point is inside of the boundary of WebElement.<br> * @param element WebElement, The element to get boundary to check with. * @param p Point, The point to check. * @return boolean, true if the point is inside of the boundary of WebElement */// ww w.jav a 2 s . c o m public static boolean inside(WebElement element, Point p) { if (p == null) return true; Dimension dimension = element.getSize(); Rectangle rect = new Rectangle(0, 0, dimension.width, dimension.height); return rect.contains(p); }
From source file:Creator.WidgetPanel.java
public void clicked(Point p) { _FTF_WigetParam_xPos.setText(String.valueOf(p.x)); _FTF_WigetParam_yPos.setText(String.valueOf(p.y)); if (!_List_MasterMapVariables.isSelectionEmpty()) { // Check to see if the selected item contains the clicked point String varName = _List_MasterMapVariables.getSelectedValue().toString(); varName = varName.substring(0, varName.indexOf(":")); String index = _ComboBox_DisplayPanel.getSelectedItem().toString(); if (index.startsWith("R:")) { //index = "Rack"; }/* w w w .j a va 2s . c o m*/ if (masterMap.get(index).containsKey(varName)) { Rectangle r = masterMap.get(index).get(varName); if (r.contains(p)) { Point per = percentage(p, r); _FTF_WigetParam_xPosPer.setValue(per.x); _FTF_WigetParam_yPosPer.setValue(per.y); } else { _FTF_WigetParam_xPosPer.setValue(-2); _FTF_WigetParam_yPosPer.setValue(-2); } } } }