本文整理匯總了Java中com.intellij.ui.awt.RelativePoint.getScreenPoint方法的典型用法代碼示例。如果您正苦於以下問題:Java RelativePoint.getScreenPoint方法的具體用法?Java RelativePoint.getScreenPoint怎麽用?Java RelativePoint.getScreenPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.awt.RelativePoint
的用法示例。
在下文中一共展示了RelativePoint.getScreenPoint方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fitsLayeredPane
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
private static boolean fitsLayeredPane(JLayeredPane pane, JComponent component, RelativePoint desiredLocation, HintHint hintHint) {
if (hintHint.isAwtTooltip()) {
Dimension size = component.getPreferredSize();
Dimension paneSize = pane.getSize();
Point target = desiredLocation.getPointOn(pane).getPoint();
Balloon.Position pos = hintHint.getPreferredPosition();
int pointer = BalloonImpl.getPointerLength(pos, false) + BalloonImpl.getNormalInset();
if (pos == Balloon.Position.above || pos == Balloon.Position.below) {
boolean heightFit = target.y - size.height - pointer > 0 || target.y + size.height + pointer < paneSize.height;
return heightFit && size.width + pointer < paneSize.width;
}
else {
boolean widthFit = target.x - size.width - pointer > 0 || target.x + size.width + pointer < paneSize.width;
return widthFit && size.height + pointer < paneSize.height;
}
}
else {
final Rectangle lpRect = new Rectangle(pane.getLocationOnScreen().x, pane.getLocationOnScreen().y, pane.getWidth(), pane.getHeight());
Rectangle componentRect = new Rectangle(desiredLocation.getScreenPoint().x,
desiredLocation.getScreenPoint().y,
component.getPreferredSize().width,
component.getPreferredSize().height);
return lpRect.contains(componentRect);
}
}
示例2: setLocation
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@Override
public void setLocation(@NotNull RelativePoint point) {
if (isRealPopup()) {
myPopup.setLocation(point.getScreenPoint());
}
else {
if (myCurrentIdeTooltip != null) {
Point screenPoint = point.getScreenPoint();
if (!screenPoint.equals(new RelativePoint(myCurrentIdeTooltip.getComponent(), myCurrentIdeTooltip.getPoint()).getScreenPoint())) {
myCurrentIdeTooltip.setPoint(point.getPoint());
myCurrentIdeTooltip.setComponent(point.getComponent());
IdeTooltipManager.getInstance().show(myCurrentIdeTooltip, true, false);
}
}
else {
Point targetPoint = point.getPoint(myComponent.getParent());
myComponent.setLocation(targetPoint);
myComponent.revalidate();
myComponent.repaint();
}
}
}
示例3: createNewDockContainerFor
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
public void createNewDockContainerFor(DockableContent content, RelativePoint point) {
DockContainer container = getFactory(content.getDockContainerType()).createContainer(content);
register(container);
final DockWindow window = createWindowFor(null, container);
Dimension size = content.getPreferredSize();
Point showPoint = point.getScreenPoint();
showPoint.x -= size.width / 2;
showPoint.y -= size.height / 2;
Rectangle target = new Rectangle(showPoint, size);
ScreenUtil.moveRectangleToFitTheScreen(target);
ScreenUtil.cropRectangleToFitTheScreen(target);
window.setLocation(target.getLocation());
window.myDockContentUiContainer.setPreferredSize(target.getSize());
window.show(false);
window.getFrame().pack();
container.add(content, new RelativePoint(target.getLocation()));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
window.myUiContainer.setPreferredSize(null);
}
});
}
示例4: isInside
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@Override
public boolean isInside(@NotNull RelativePoint target) {
if (myComp == null) return false;
Component cmp = target.getOriginalComponent();
if (!cmp.isShowing()) return true;
if (cmp == myCloseRec) return true;
if (UIUtil.isDescendingFrom(cmp, myComp)) return true;
if (myComp == null || !myComp.isShowing()) return false;
Point point = target.getScreenPoint();
SwingUtilities.convertPointFromScreen(point, myComp);
return myComp.contains(point);
}
示例5: 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);
}
示例6: fitToScreen
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
private static Rectangle fitToScreen(@NotNull Dimension newDim, @NotNull RelativePoint popupPosition, JTable table) {
Rectangle rectangle = new Rectangle(popupPosition.getScreenPoint(), newDim);
ScreenUtil.fitToScreen(rectangle);
if (rectangle.getHeight() != newDim.getHeight()) {
int newHeight = (int)rectangle.getHeight();
int roundedHeight = newHeight - newHeight % table.getRowHeight();
rectangle.setSize((int)rectangle.getWidth(), Math.max(roundedHeight, table.getRowHeight()));
}
return rectangle;
}
示例7: add
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@Override
public void add(@NotNull DockableContent content, RelativePoint dropTarget) {
if (content.getKey() instanceof VirtualFile) {
VirtualFile vFile = (VirtualFile)content.getKey();
final PsiFileSystemItem psiFile = vFile.isDirectory()
? PsiManager.getInstance(myProject).findDirectory(vFile)
: PsiManager.getInstance(myProject).findFile(vFile);
Point p = dropTarget.getScreenPoint();
SwingUtilities.convertPointFromScreen(p, myTree);
FavoritesListNode node = findFavoritesListNode(p);
if (node != null && psiFile != null) {
dropPsiElements(myFavoritesManager, node, new PsiElement[]{psiFile});
}
}
}
示例8: processDropOver
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@Nullable
@Override
public Image processDropOver(@NotNull DockableContent content, RelativePoint point) {
Point p = point.getScreenPoint();
SwingUtilities.convertPointFromScreen(p, myTree);
TreePath treePath = myTree.getClosestPathForLocation(p.x, p.y);
FavoritesListNode node = getListNodeFromPath(treePath);
treePath = node != null ? myTree.getPath(node) : null;
if (treePath != null) {
myTree.setSelectionPath(treePath);
}
return null;
}
示例9: show
import com.intellij.ui.awt.RelativePoint; //導入方法依賴的package包/類
@Override
public void show(@NotNull RelativePoint aPoint) {
final Point screenPoint = aPoint.getScreenPoint();
show(aPoint.getComponent(), screenPoint.x, screenPoint.y, false);
}