当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.convertPointToScreen方法代码示例

本文整理汇总了Java中javax.swing.SwingUtilities.convertPointToScreen方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.convertPointToScreen方法的具体用法?Java SwingUtilities.convertPointToScreen怎么用?Java SwingUtilities.convertPointToScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.convertPointToScreen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: right

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean right() {
        Fix f = (Fix) getSelectedValue();
        Iterable<? extends Fix> subfixes = HintsControllerImpl.getSubfixes(f);

        if (subfixes.iterator().hasNext()) {
            Rectangle r = getCellBounds(getSelectedIndex(), getSelectedIndex());
            Point p = new Point(r.getLocation());
            SwingUtilities.convertPointToScreen(p, this);
            p.x += r.width;
//            p.y += r.height;
            HintsUI.getDefault().openSubList(subfixes, p);
            return true;
        }

        return false;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ListCompletionView.java

示例2: press

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void press() throws AWTException {
    Point point = this.table.getCellRect(1, 1, false).getLocation();
    SwingUtilities.convertPointToScreen(point, this.table);

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    robot.mouseMove(point.x + 1, point.y + 1);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Test6505027.java

示例3: mouseDragged

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
	Point newPos = e.getPoint();
	SwingUtilities.convertPointToScreen(newPos, SizeGrip.this);
	int xDelta = newPos.x - origPos.x;
	int yDelta = newPos.y - origPos.y;
	Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this);
	if (wind!=null) { // Should always be true
		if (getComponentOrientation().isLeftToRight()) {
			int w = wind.getWidth();
			if (newPos.x>=wind.getX()) {
				w += xDelta;
			}
			int h = wind.getHeight();
			if (newPos.y>=wind.getY()) {
				h += yDelta;
			}
			wind.setSize(w,h);
		}
		else { // RTL
			int newW = Math.max(1, wind.getWidth()-xDelta);
			int newH = Math.max(1, wind.getHeight()+yDelta);
			wind.setBounds(newPos.x, wind.getY(), newW, newH);
		}
		// invalidate()/validate() needed pre-1.6.
		wind.invalidate();
		wind.validate();
	}
	origPos.setLocation(newPos);
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:31,代码来源:SizeGrip.java

示例4: showTooltipWindow

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 *
 * @param event
 */
private void showTooltipWindow (MouseEvent event) {
    Point p = new Point(event.getPoint());
    SwingUtilities.convertPointToScreen(p, this);
    Point p2 = new Point(p);
    SwingUtilities.convertPointFromScreen(p2, textComponent);
    
    // annotation for target line
    AnnotateLine al = null;
    if (!elementAnnotations.isEmpty()) {
        al = getAnnotateLine(getLineFromMouseEvent(event));
    }

    /**
     * al.getCommitMessage() != null - since commit messages are initialized separately from the AL constructor
     */
    if (al != null && al.getCommitMessage() != null) {
        TooltipWindow ttw = new TooltipWindow(this, al);
        ttw.show(new Point(p.x - p2.x, p.y));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AnnotationBar.java

示例5: setVisible

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void setVisible(boolean visible) {
    if (visible) {
        if (size == null) {
            size = getSize();
        }

        TopComponent editor = WindowManager.getDefault().getRegistry().getActivated();
        Rectangle b = editor.getBounds();
        Point location = new Point((b.x + (b.width / 2)) - (size.width / 2), (b.y + (b.height / 2)) - (size.height / 2));
        SwingUtilities.convertPointToScreen(location, editor);
        setLocation(location);
    }

    super.setVisible(visible);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ToggleProfilingPointAction.java

示例6: pan

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private boolean pan (Widget widget, Point newLocation) {
    if (scrollPane == null  ||  scene != widget.getScene ())
        return false;
    newLocation = scene.convertSceneToView (widget.convertLocalToScene (newLocation));
    SwingUtilities.convertPointToScreen (newLocation, scene.getView ());
    JComponent view = scene.getView ();
    Rectangle rectangle = view.getVisibleRect ();
    rectangle.x += lastLocation.x - newLocation.x;
    rectangle.y += lastLocation.y - newLocation.y;
    view.scrollRectToVisible (rectangle);
    lastLocation = newLocation;
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:CustomizablePanAction.java

示例7: mouseReleased

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseReleased(final MouseEvent me) {
    if (!ourToolBarIsDragging)
        return;

    if ((me.getModifiers() & InputEvent.BUTTON1_MASK) != InputEvent.BUTTON1_MASK) {
        return;
    }

    hideDraggingWindow();

    final Container target = ourDockLayout.getTargetContainer();
    if (target == null)
        return;

    Point p = me.getPoint();
    p = SwingUtilities.convertPoint(ourToolBar, p, target);

    DockBoundary dock = null;

    if (!me.isControlDown()) {
        dock = getDockableBoundary(p);
        if (dock != null) {
            setDockIndex(dock.getDockIndex(p));
            setRowIndex(dock.getRowIndex(p));
            setDockEdge(dock.getEdge());
        }
    }

    if (dock != null) {
        dockToolBar(getDockEdge(), getRowIndex(), getDockIndex());
    } else {
        SwingUtilities.convertPointToScreen(p, target);
        floatToolBar(p.x, p.y, true);
    }

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:38,代码来源:Handler.java

示例8: dragGestureRecognized

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void dragGestureRecognized(DragGestureEvent dge) {

      Point mousePosition = dge.getDragOrigin();
      Point piecePosition = new Point(myStack.pos);

      // Check drag starts inside piece
      Rectangle r = myStack.stackConfigurer.getPieceBoundingBox();
      r.translate(piecePosition.x, piecePosition.y);
      if (!r.contains(mousePosition)) {
        return;
      }

      originalPieceOffsetX = piecePosition.x - mousePosition.x;
      originalPieceOffsetY = piecePosition.y - mousePosition.y;

      drawWin = null;

      makeDragCursor();
      setDragCursor();

      SwingUtilities.convertPointToScreen(mousePosition, drawWin);
      moveDragCursor(mousePosition.x, mousePosition.y);

      // begin dragging
      try {
        dge.startDrag(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
                      new StringSelection(""), this); // DEBUG
        dge.getDragSource().addDragSourceMotionListener(this);
      }
      catch (InvalidDnDOperationException e) {
        ErrorDialog.bug(e);
      }
    }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:34,代码来源:SetupStack.java

示例9: resizePopup

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private static void resizePopup() {
    popupWindow.pack();
    Point point = new Point(0,0);
    SwingUtilities.convertPointToScreen(point, getMainWindow());
    popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2, 
                             point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:PopupUtil.java

示例10: calcDrawOffset

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/** calculates the offset between cursor dragCursor positions */
private void calcDrawOffset() {
  if (drawWin != null) {
    // drawOffset is the offset between the mouse location during a drag
    // and the upper-left corner of the cursor
    // accounts for difference between event point (screen coords)
    // and Layered Pane position, boundingBox and off-center drag
    drawOffset.x = -boundingBox.x - currentPieceOffsetX + EXTRA_BORDER;
    drawOffset.y = -boundingBox.y - currentPieceOffsetY + EXTRA_BORDER;
    SwingUtilities.convertPointToScreen(drawOffset, drawWin);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:PieceMover.java

示例11: mouseClicked

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private static void mouseClicked(Map<String, List<OverrideDescription>> caption2Descriptions, JTextComponent c, Point p) {
    if (caption2Descriptions.size() == 1 && caption2Descriptions.values().iterator().next().size() == 1) {
        OverrideDescription desc = caption2Descriptions.values().iterator().next().get(0);
        FileObject file = desc.location.getLocation().getFileObject();

        if (file != null) {
            UiUtils.open(file, desc.location.getLocation().getOffset());
        } else {
            Toolkit.getDefaultToolkit().beep();
        }

        return ;
    }
    
    Point position = new Point(p);

    SwingUtilities.convertPointToScreen(position, c);

    StringBuilder caption = new StringBuilder();
    List<OverrideDescription> descriptions = new LinkedList<OverrideDescription>();
    boolean first = true;

    for (Entry<String, List<OverrideDescription>> e : caption2Descriptions.entrySet()) {
        if (!first) {
            caption.append("/");
        }
        first = false;
        caption.append(e.getKey());
        descriptions.addAll(e.getValue());
    }

    PopupUtil.showPopup(new IsOverriddenPopup(caption.toString(), descriptions), caption.toString(), position.x, position.y, true, 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:IsOverriddenAnnotationAction.java

示例12: resizePopup

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private static void resizePopup() {
    popupWindow.pack();
    Point point = new Point(0, 0);
    SwingUtilities.convertPointToScreen(point, getMainWindow());
    popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
            point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:PopupUtil.java

示例13: guessSlideSide

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
 public String guessSlideSide (TopComponent comp) {
     String toReturn = Constants.LEFT;
     if (hierarchy.getMaximizedModeView() != null) {
//issue #58562
         toReturn = (String)comp.getClientProperty("lastSlideSide");
         if (toReturn == null) {
             //TODO? now how does one figure on startup with maximazed mode where the editor is?
             toReturn = Constants.LEFT;
         }
     } else {
         Rectangle editorb = hierarchy.getPureEditorAreaBounds();
         Point leftTop = new Point(0, 0);
         SwingUtilities.convertPointToScreen(leftTop, comp);
         if (editorb.x > leftTop.x) {
             toReturn = Constants.LEFT;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
         if ((editorb.x + editorb.width) < leftTop.x) {
             toReturn = Constants.RIGHT;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
         if ((editorb.y + editorb.height) < leftTop.y) {
             toReturn = Constants.BOTTOM;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
     }
     return toReturn;
 }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:DefaultView.java

示例14: showPanel

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void showPanel(Component owner) {
    if (pop != null) pop.hide();
    Point show = new Point(0, showDate.getHeight());
    SwingUtilities.convertPointToScreen(show, showDate);
    Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
    int x = show.x;
    int y = show.y;
    if (x < 0) x = 0;
    if (x > size.width - 212) x = size.width - 212;
    if (y > size.height - 167) y -= 165;
    pop = PopupFactory.getSharedInstance().getPopup(owner, calendarPanel, x, y);
    pop.show();
    isShow = true;
}
 
开发者ID:sivanWu0222,项目名称:SimpleERP,代码行数:15,代码来源:Chooser.java

示例15: dragGestureRecognized

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void dragGestureRecognized(DragGestureEvent dge) {

        final Point mousePosition = dge.getDragOrigin();
        dragStart = new Point(mousePosition);
        final Region r = grid.getRegion(mousePosition);
        if (r == null) {
          return;
        }

        Point piecePosition = new Point(r.getOrigin());

        originalPieceOffsetX = piecePosition.x - mousePosition.x;
        originalPieceOffsetY = piecePosition.y - mousePosition.y;

        drawWin = null;

        makeDragCursor();
        setDragCursor();

        SwingUtilities.convertPointToScreen(drawOffset, drawWin);
        SwingUtilities.convertPointToScreen(mousePosition, drawWin);
        moveDragCursor(mousePosition.x, mousePosition.y);

        // begin dragging
        try {
          dge.startDrag(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
                        new StringSelection(""), this); //$NON-NLS-1$
          dge.getDragSource().addDragSourceMotionListener(this);
        }
        catch (InvalidDnDOperationException e) {
          ErrorDialog.bug(e);
        }
      }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:34,代码来源:RegionGrid.java


注:本文中的javax.swing.SwingUtilities.convertPointToScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。