本文整理匯總了Java中com.intellij.ui.awt.RelativePoint.getComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java RelativePoint.getComponent方法的具體用法?Java RelativePoint.getComponent怎麽用?Java RelativePoint.getComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.awt.RelativePoint
的用法示例。
在下文中一共展示了RelativePoint.getComponent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isMovingForward
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
public boolean isMovingForward(RelativePoint target) {
try {
if (myComp == null || !myComp.isShowing()) return false;
if (myPrevMousePoint == null) return true;
if (myPrevMousePoint.getComponent() != target.getComponent()) return false;
Rectangle rectangleOnScreen = new Rectangle(myComp.getLocationOnScreen(), myComp.getSize());
return ScreenUtil.isMovementTowards(myPrevMousePoint.getScreenPoint(), target.getScreenPoint(), rectangleOnScreen);
}
finally {
myPrevMousePoint = target;
}
}
示例2: guessBestPopupLocation
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@NotNull
private RelativePoint guessBestPopupLocation(@NotNull Editor editor) {
RelativePoint preferredLocation = JBPopupFactory.getInstance().guessBestPopupLocation(editor);
if (myDimensionServiceKey == null) {
return preferredLocation;
}
Dimension preferredSize = DimensionService.getInstance().getSize(myDimensionServiceKey, myProject);
if (preferredSize == null) {
return preferredLocation;
}
Rectangle preferredBounds = new Rectangle(preferredLocation.getScreenPoint(), preferredSize);
Rectangle adjustedBounds = new Rectangle(preferredBounds);
ScreenUtil.moveRectangleToFitTheScreen(adjustedBounds);
if (preferredBounds.y - adjustedBounds.y <= 0) {
return preferredLocation;
}
int adjustedY = preferredBounds.y - editor.getLineHeight() * 3 / 2 - preferredSize.height;
if (adjustedY < 0) {
return preferredLocation;
}
Point point = new Point(preferredBounds.x, adjustedY);
Component component = preferredLocation.getComponent();
if (component == null) {
return RelativePoint.fromScreen(point);
}
SwingUtilities.convertPointFromScreen(point, component);
return new RelativePoint(component, point);
}
示例3: Static
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
public Static(RelativePoint point) {
super(point.getComponent());
myPoint = point;
}