java类java.awt.MouseInfo的实例源码

ComponentHelper.java 文件源码 项目:Equella 阅读 24 收藏 0 点赞 0 评论 0
public static void centreOnScreen(Window window)
{
    Window owner = window.getOwner();

    // If the window has an owner, use the same graphics configuration so it
    // will
    // open on the same screen. Otherwise, grab the mouse pointer and work
    // from there.
    GraphicsConfiguration gc = owner != null ? owner.getGraphicsConfiguration() : MouseInfo.getPointerInfo()
        .getDevice().getDefaultConfiguration();

    if( gc != null )
    {
        window.setBounds(centre(getUsableScreenBounds(gc), window.getBounds()));
    }
    else
    {
        // Fall-back to letting Java do the work
        window.setLocationRelativeTo(null);
    }
}
RelationalField.java 文件源码 项目:fwm 阅读 19 收藏 0 点赞 0 评论 0
@FXML
private void handleAddButton() {
        popup.setAutoHide( true );
        popup.setHideOnEscape( true );
        popup.setAutoFix( true );

        try {
            sl = SearchList.createSearchList(relationType, this);
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        popup.getContent().addAll(sl.getOurRoot());

        Point p = MouseInfo.getPointerInfo().getLocation();
        popup.show( getOurRoot(), p.getX(), p.getY());

        sl.setMaxImageSize(16);
        sl.getSearchField().requestFocus();


}
Jogl3Mouse.java 文件源码 项目:2017-TeamEngine 阅读 20 收藏 0 点赞 0 评论 0
public void update() {
    synchronized (lock) {
        for (int i = 0; i < MAX_BUTTONS; i++) {
            if (down[i]) {
                buttons[i]++; 
            }
            else {
                buttons[i] = 0; 
            }
        }
        Point p = MouseInfo.getPointerInfo().getLocation(); 
        int curX = p.x - display.getX(); 
        int curY = p.y - display.getY(); 
        dx = curX - x; 
        dy = curY - y; 
        x = curX; 
        y = curY; 
        dir = curDir; 

        curDir = ScrollDirection.NONE; 
    }
}
Jogl3Mouse.java 文件源码 项目:2017-TeamEngine 阅读 22 收藏 0 点赞 0 评论 0
@Override
    public void setPosition(float newX, float newY) {
        synchronized (lock) {
            Point p = MouseInfo.getPointerInfo().getLocation(); 
            int curX = p.x - display.getX(); 
            int curY = p.y - display.getY(); 
            int oldX = x; 
            int oldY = x; 

            this.x = (int)newX; 
            this.y = (int)(display.getHeight() - (int)newY - 1); 
            if (display.getCanvas().hasFocus()) robot.mouseMove(display.getX() + this.x, display.getY() + this.y); 
//            resetPosition(); 

            this.dx = curX - oldX; 
            this.dy = curY - oldY; 

//            lastX += -(curX - oldX); 
//            lastY += -(curY - oldY); 
        }
    }
ScreenRegionGrab.java 文件源码 项目:MTG-Card-Recognizer 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void mouseClicked(MouseEvent arg0) {
    Point p = MouseInfo.getPointerInfo().getLocation();
    if(num==1)
    {
        pt1 = p;
        win2 = new ScreenRegionGrab(2);
    }
    else
    {
        pt2 = p;
        int x = Math.min(pt1.x,pt2.x);
        int y = Math.min(pt1.y, pt2.y);
        int w = Math.max(pt1.x,pt2.x)-x;
        int h = Math.max(pt1.y,pt2.y)-y;
        BufferedImage a = rob.createScreenCapture(new Rectangle(x,y,w,h));
        RecogApp.doRecog(a);
        win1.dispose();
        win1=win2=null;
        pt1=pt2=null;
        dispose();
    }
}
FreeColButtonUI.java 文件源码 项目:freecol 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void paint(Graphics g, JComponent c) {
    LAFUtilities.setProperties(g, c);

    if (c.isOpaque()) {
        ImageLibrary.drawTiledImage("image.background.FreeColButton", g, c, null);
    }
    super.paint(g, c);

    AbstractButton a = (AbstractButton) c;
    if (a.isRolloverEnabled()) {
        Point p = MouseInfo.getPointerInfo().getLocation();
        SwingUtilities.convertPointFromScreen(p, c);
        boolean rollover = c.contains(p);
        if (rollover) {
            paintButtonPressed(g, (AbstractButton) c);
        }
    }
}
ToolTipList.java 文件源码 项目:WordnetLoom 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void onSuccess(final Object o) {

    /**
     * naprawione odświeżanie się tooltipów po załadowaniu
     */
    final Point locationOnScreen = MouseInfo.getPointerInfo().getLocation();
    final Point locationOnComponent = new Point(locationOnScreen);
    SwingUtilities.convertPointFromScreen(locationOnComponent, component);
    if (component.contains(locationOnComponent)) {
        SwingUtilities.invokeLater(() -> {
            ToolTipManager.sharedInstance().mouseMoved(
                    new MouseEvent(component, -1, System.currentTimeMillis(),
                            0, locationOnComponent.x, locationOnComponent.y,
                            locationOnScreen.x, locationOnScreen.y, 0, false, 0));
        });
    }
}
PaletteContainerListener.java 文件源码 项目:Hydrograph 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void mouseHover(MouseEvent e) {
    final java.awt.Point mouseLocation1 = MouseInfo.getPointerInfo().getLocation();
    EditPart paletteInternalController = viewer.findObjectAt(new Point(
            e.x, e.y));

    if(paletteInternalController.getModel() instanceof CombinedTemplateCreationEntry){

        setGenericComponent(paletteInternalController);

        // Hide tooltip if already showing
        hidePaletteToolTip();

        showToolTipWithDelay(mouseLocation1);
    }
}
FreeColButtonUI.java 文件源码 项目:FreeCol 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void paint(Graphics g, JComponent c) {
    LAFUtilities.setProperties(g, c);

    if (c.isOpaque()) {
        ImageLibrary.drawTiledImage("image.background.FreeColButton", g, c, null);
    }
    super.paint(g, c);

    AbstractButton a = (AbstractButton) c;
    if (a.isRolloverEnabled()) {
        Point p = MouseInfo.getPointerInfo().getLocation();
        SwingUtilities.convertPointFromScreen(p, c);
        boolean rollover = c.contains(p);
        if (rollover) {
            paintButtonPressed(g, (AbstractButton) c);
        }
    }
}
XMap.java 文件源码 项目:geomapapp 阅读 28 收藏 0 点赞 0 评论 0
public void keyPressed(KeyEvent e) {
    if ( e.getKeyCode() == KeyEvent.VK_SPACE) {
        setSpaceBarPress(true);
    }

    if(getSpaceBarPress()) {
        // Set locations
        screenPressedX = MouseInfo.getPointerInfo().getLocation().x;
        screenPressedY = MouseInfo.getPointerInfo().getLocation().y;
        pressedX = scrollPane.getHorizontalScrollBar().getValue();
        pressedY = scrollPane.getVerticalScrollBar().getValue();

        // Set cursor to closed hand
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        ClassLoader loader = org.geomapapp.util.Icons.class.getClassLoader();
        String path = "org/geomapapp/resources/icons/close_hand.png";
        java.net.URL url = loader.getResource(path);
        try {
            BufferedImage im = ImageIO.read(url);
            Cursor closeHandCursor = toolkit.createCustomCursor( im, new Point(0,0), "close_hand");
            setCursor(closeHandCursor);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}
AddElementAction.java 文件源码 项目:avro-schema-editor 阅读 19 收藏 0 点赞 0 评论 0
protected void openPopupMenu(NodeType[] availableTypes, final AvroNode targetNode, final AvroContext context) {

    Shell shell = Display.getCurrent().getActiveShell();
    final Menu menu = new Menu(shell, SWT.POP_UP);
    for (NodeType availableType : availableTypes) {
        final NodeType type = availableType;
        MenuItem item = new MenuItem(menu, SWT.PUSH);
        item.setText(type.getDisplayLabel());
        item.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event e) {
                menu.dispose();
                IEditCommand cmd = context.getService(IEditCommandFactory.class)
                        .createAddElementCommand(targetNode, type, getNotifications());
                context.getService(ICommandExecutor.class).execute(cmd);
            }
        });
    }

    Point location = MouseInfo.getPointerInfo().getLocation();
    int x = location.x;
    int y = location.y;
       menu.setLocation(x, y);
       menu.setVisible(true);

}
AbstractScreenRecorder.java 文件源码 项目:screencast4j 阅读 22 收藏 0 点赞 0 评论 0
/**
  * Draws the cursor on the frame, if required.
  *
  * @param frame    the frame to update
  * @return     the (potentially) updated frame
  */
 protected BufferedImage drawCursor(BufferedImage frame) {
   PointerInfo  pointer;

   if (m_CaptureMouse && (m_Cursor != null)) {
     pointer = MouseInfo.getPointerInfo();
     frame.getGraphics().drawImage(
m_Cursor,
(int) pointer.getLocation().getX() - m_X,
(int) pointer.getLocation().getY() - m_Y,
m_Cursor.getWidth(null),
m_Cursor.getHeight(null),
m_BackgroundColor,
null);
   }

   return frame;
 }
AWTUtil.java 文件源码 项目:PhET 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Use reflection to access the JDK 1.5 pointer location, if possible and
 * only if the given component is on the same screen as the cursor. Return
 * null otherwise.
 */
private static Point getPointerLocation(final Component component) {
    try {
        final GraphicsConfiguration config = component.getGraphicsConfiguration();
        if (config != null) {
            PointerInfo pointer_info = AccessController.doPrivileged(new PrivilegedExceptionAction<PointerInfo>() {
                public PointerInfo run() throws Exception {
                    return MouseInfo.getPointerInfo();
                }
            });
            GraphicsDevice device = pointer_info.getDevice();
            if (device == config.getDevice()) {
                return pointer_info.getLocation();
            }
            return null;
        }
    } catch (Exception e) {
        LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
    }
    return null;
}
AnalyzerGroupPane.java 文件源码 项目:djigger 阅读 19 收藏 0 点赞 0 评论 0
public AnalyzerGroupPane(final Session parent, final NodePresentationHelper presentationHelper) {
    super(false);
    this.parent = parent;
    listeners = new ArrayList<AnalyzerPaneListener>();
       addChangeListener(this);
       analyzerService = new AnalyzerService();
       this.presentationHelper = presentationHelper;  

       final AnalyzerGroupPane me = this;
       setAddTabAction(new Runnable() {

        @Override
        public void run() {
            Point p1 = MouseInfo.getPointerInfo().getLocation();
            SwingUtilities.convertPointFromScreen(p1, me);

            AddTabPopUp popup = new AddTabPopUp(me);
            popup.show(me, p1.x, p1.y);
        }
    });
}
DiagramPanel.java 文件源码 项目:graphexample 阅读 22 收藏 0 点赞 0 评论 0
private void canvasMouseDown(MouseEvent e) {
    if (rootDiagramObject == null)
        return;

    // SetFocus; // don't remember for what purpose??
    Point cursorPos = MouseInfo.getPointerInfo().getLocation();
    if (panningMode) {
        // set mouse cursor to 'closed hand'
        // Screen.Cursor = crClHand;

        startPoint.x = round(hsb.getValue() / SCROLL_FACTOR + cursorPos.x / scale);
        startPoint.y = round(vsb.getValue() / SCROLL_FACTOR + cursorPos.y / scale);
    } else {
        SwingUtilities.convertPointFromScreen(cursorPos, canvas);
        startPoint.setLocation(cursorPos);
        currentPoint.setLocation(startPoint);
        selection.mouseDown(rootDiagramObject.testHit(currentPoint.x, currentPoint.y),
                (e.getModifiersEx() & (InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) > 0);
        mouseDown = true;
    }
}
DiagramPanel.java 文件源码 项目:graphexample 阅读 22 收藏 0 点赞 0 评论 0
private void canvasMouseDragged(MouseEvent e) {
    if (rootDiagramObject == null)
        return;
    Point cursorPos = MouseInfo.getPointerInfo().getLocation();
    if (panningMode) {
        // передвижение картинки как единого целого
        hsb.setValue(round((startPoint.x - cursorPos.x / scale) * SCROLL_FACTOR));
        vsb.setValue(round((startPoint.y - cursorPos.y / scale) * SCROLL_FACTOR));
    } else {
        if (!mouseDown)
            return;
        // передвижение одного объекта на картинке
        selection.mouseMove(currentPoint.x - startPoint.x, currentPoint.y - startPoint.y);
        SwingUtilities.convertPointFromScreen(cursorPos, canvas);
        currentPoint.setLocation(cursorPos);
        selection.mouseMove(currentPoint.x - startPoint.x, currentPoint.y - startPoint.y);
    }
}
MouseEngine.java 文件源码 项目:Dayon 阅读 20 收藏 0 点赞 0 评论 0
private void mainLoop() throws InterruptedException {
    long start = System.currentTimeMillis();
    int captureCount = 0;

    Point previous = new Point(-1, -1);

    while (true) {
        final Point current = MouseInfo.getPointerInfo().getLocation();

        ++captureCount;

        if (!current.equals(previous)) {
            if (fireOnLocationUpdated(current)) {
                previous = current;
            }
        }

        final int delayedCaptureCount = syncOnTick(start, captureCount, 50);

        captureCount += delayedCaptureCount;
    }
}
SwingTools.java 文件源码 项目:SweetHome3D 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Returns a scroll bar adjustment listener bound to the given <code>scrollPane</code> view
 * that updates view tool tip when its vertical scroll bar is adjusted.
 */
public static AdjustmentListener createAdjustmentListenerUpdatingScrollPaneViewToolTip(final JScrollPane scrollPane)
{
    return new AdjustmentListener()
    {
        public void adjustmentValueChanged(AdjustmentEvent ev)
        {
            Point screenLocation = MouseInfo.getPointerInfo().getLocation();
            Point point = new Point(screenLocation);
            Component view = scrollPane.getViewport().getView();
            SwingUtilities.convertPointFromScreen(point, view);
            if (scrollPane.isShowing() && scrollPane.getViewport().getViewRect().contains(point))
            {
                MouseEvent mouseEvent = new MouseEvent(view, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0,
                        point.x, point.y, 0, false, MouseEvent.NOBUTTON);
                if (isToolTipShowing())
                {
                    ToolTipManager.sharedInstance().mouseMoved(mouseEvent);
                }
            }
        }
    };
}
Viewer.java 文件源码 项目:SporeModder 阅读 25 收藏 0 点赞 0 评论 0
private void update(){
    jFrame.setTitle("DDS Viewer - "+item.getFile().getName());
    jImageLabel.setIcon(new ImageIcon(item.getImage()));
    //jNameLabel.setText("  Name: "+item.getFile().getName());
    jDimensionLabel.setText("  Size: "+item.getImage().getWidth()+"x"+item.getImage().getHeight());
    jMipMapLabel.setText("  MipMap: "+(mipMap+1)+"/"+mipMapMax);
    jFormatLabel.setText("  Format: "+format);

    //Force mouse movment...
    Point b = MouseInfo.getPointerInfo().getLocation();
       int x = (int) b.getX();
       int y = (int) b.getY();
    try {
        Robot r = new Robot();
        r.mouseMove(x, y-1);
        r.mouseMove(x, y);
    } catch (AWTException ex) {

    }
}
GamePApplet.java 文件源码 项目:Eve 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void mousePressed() {
    Point globalMousePoint = MouseInfo.getPointerInfo().getLocation();
    Point globalWindowPoint = getLocationOnScreen().getLocation();
    float localMouseX = globalMousePoint.x - globalWindowPoint.x;
    float localMouseY = globalMousePoint.y - globalWindowPoint.y;

    if(mouseTarget == null) {
        mouseTarget = new Breadcrumb(new PVector(localMouseX, localMouseY));
        this.gameObjects.add(mouseTarget);
    } else{
        mouseTarget.getRigidbody2D().setPosition(new PVector(localMouseX, localMouseY));
    }

    mouseTarget.setVisible(true);
}
TInterpreterFullscreenAction.java 文件源码 项目:ArasuiteIta 阅读 20 收藏 0 点赞 0 评论 0
public void mouseMoved(MouseEvent e) {
    //check if there is an open menu        
    boolean hasSelectedMenu = false;
    for (int i = 0; i < menu.getMenuCount() && !hasSelectedMenu; ++i) {
        if (menu.getMenu(i).isSelected()) {
            hasSelectedMenu = true;
        }
    }

    Point pos = MouseInfo.getPointerInfo().getLocation();
    if (!hasSelectedMenu) {
        if (menu.isVisible()) {
            menu.setVisible(pos.y < menu.getHeight());
        } else {
            menu.setVisible(pos.y < 5);
        }
    }

    if (pos.y > screenSize.height - 15) {
        sp.setDividerLocation(screenSize.height - 100);
        sp.setDividerSize(5);
    } else if (pos.y < screenSize.height - 100) {
        sp.setDividerLocation(screenSize.height - 5);
        sp.setDividerSize(0);
    }
}
AbstractScreenRecorder.java 文件源码 项目:screencast4j 阅读 21 收藏 0 点赞 0 评论 0
/**
  * Draws the cursor on the frame, if required.
  *
  * @param frame    the frame to update
  * @return     the (potentially) updated frame
  */
 protected BufferedImage drawCursor(BufferedImage frame) {
   PointerInfo  pointer;

   if (m_CaptureMouse && (m_Cursor != null)) {
     pointer = MouseInfo.getPointerInfo();
     frame.getGraphics().drawImage(
m_Cursor,
(int) pointer.getLocation().getX() - m_X,
(int) pointer.getLocation().getY() - m_Y,
m_Cursor.getWidth(null),
m_Cursor.getHeight(null),
m_BackgroundColor,
null);
   }

   return frame;
 }
UIMouse.java 文件源码 项目:open-ig 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Create a mouse movement event as if the mouse just
 * moved to its current position.
 * @param c the base swing component to relativize the mouse location
 * @return the mouse event
 */
public static UIMouse createCurrent(Component c) {
    UIMouse m = new UIMouse();
    m.type = UIMouse.Type.MOVE;
    PointerInfo pointerInfo = MouseInfo.getPointerInfo();
    if (pointerInfo != null) {
        Point pm = pointerInfo.getLocation();
        Point pc = new Point(0, 0);
        try {
            pc = c.getLocationOnScreen();
        } catch (IllegalStateException ex) {
            // ignored
        }
        m.x = pm.x - pc.x;
        m.y = pm.y - pc.y;
    }
    return m;
}
Painter.java 文件源码 项目:stickes 阅读 21 收藏 0 点赞 0 评论 0
public void drawMouseData(Graphics g, Visual v, List<Point> mousepath) {
    if (mousepath.isEmpty()) {
        return;
    }
    g.setColor(Color.GREEN);
    Point last;
    Point current;
    for (int i = 1; i < mousepath.size(); i++) {
        last = mousepath.get(i - 1);
        current = mousepath.get(i);
        g.drawLine(last.x, last.y, current.x, current.y);
    }
    last = mousepath.get(mousepath.size() - 1);
    Point ml = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(ml, v);
    g.drawLine(last.x, last.y, ml.x, ml.y);
}
ActivityTracker.java 文件源码 项目:chatty 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Check if mouse location has changed from previous check.
 */
private static void checkMouseLocation() {
    PointerInfo info = MouseInfo.getPointerInfo();
    // This can sometimes be null, so check for it (e.g. when Windows' UAC
    // screen is active)
    if (info == null) {
        return;
    }
    Point currentLocation = info.getLocation();

    if (lastLocation != null && !lastLocation.equals(currentLocation)) {
        lastMoved = System.currentTimeMillis();
        triggerActivity();
    }
    lastLocation = currentLocation;
}
UpdateProgressBar.java 文件源码 项目:stendhal 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Creates update progress bar.
 * 
 * @param max max file size
 * @param urlBase base url for the browser
 * @param fromVersion the version the update is based on, may be <code>null</code>
 * @param toVersion the version the download leads to
 */
UpdateProgressBar(final int max, final String urlBase, final String fromVersion, final String toVersion) {
    super("Downloading...", MouseInfo.getPointerInfo().getDevice().getDefaultConfiguration());
    setLocationByPlatform(true);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new UpdateProgressBarWindowListener());

    this.max = max;
    this.urlBase = urlBase;
    this.fromVersion = fromVersion;
    this.toVersion = toVersion;

    try {
        final URL url = this.getClass().getClassLoader().getResource(
                ClientGameConfiguration.get("GAME_ICON"));
        setIconImage(new ImageIcon(url).getImage());
    } catch (final RuntimeException e) {
        // in case that resource is not available
    }

    initializeComponents();

    this.pack();
}
MainFrame.java 文件源码 项目:stendhal 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Prepare a frame for use as the main window, or create a new one if
 * needed.
 * 
 * @param frame frame to be used as the main game window. If
 *  <code>null</code>, then a new frame will be created
 * @return frame suitable for use as the main game window
 */
static JFrame prepare(JFrame frame) {
    if (frame == null) {
        // Open on the screen where the mouse cursor is
        GraphicsConfiguration gc = MouseInfo.getPointerInfo().getDevice().getDefaultConfiguration();
        frame =  new JFrame(gc);
        frame.setLocationByPlatform(true);
    }
    setTitle(frame);
    setIcon(frame);
    // Splash screen uses the same identifier on purpose. It is the same 
    // window.
    WindowUtils.trackLocation(frame, "main", true);
    /*
     * When the user tries to close the window, don't close immediately,
     * but let it show a confirmation dialog.
     */
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    WindowUtils.closeOnEscape(frame);

    return frame;
}
ToolTipController.java 文件源码 项目:AppWoksUtils 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 
 */
protected void showTooltip() {
    ToolTipController.this.hideTooltip();
    final JComponent aC = ToolTipController.this.activeComponent;
    if (aC != null && (!aC.isFocusable() || aC.hasFocus() || ((ToolTipHandler) aC).isTooltipWithoutFocusEnabled()) && !ToolTipController.this.isTooltipVisible() && ToolTipController.this.mouseOverComponent(MouseInfo.getPointerInfo().getLocation())) {
        if (aC instanceof JTable && ((JTable) aC).getDropLocation() != null) {
            System.out.println("drop is going on");
            return;
        }
        final Window ownerWindow = SwingUtilities.getWindowAncestor(aC);
        // if the components window is not the active any more, for exmaple
        // because we opened a dialog, don't show tooltip

        if (ownerWindow.isActive()) {
            final Point p = new Point(ToolTipController.this.mousePosition);
            SwingUtilities.convertPointFromScreen(p, aC);
            this.show(((ToolTipHandler) aC).createExtTooltip(p));
        }

    }

}
Core.java 文件源码 项目:openmeetings 阅读 25 收藏 0 点赞 0 评论 0
public void sendCursorStatus() {
    try {
        Point mouseP = MouseInfo.getPointerInfo().getLocation();

        float scaleFactor = (1.0f * dim.getResizeX()) / dim.getSpinnerWidth();

        // Real size: Real mouse position = Resize : X
        int x = (int)((mouseP.getX() - dim.getSpinnerX()) * scaleFactor);
        int y = (int)((mouseP.getY() - dim.getSpinnerY()) * scaleFactor);

        if (instance.getConnection() != null) {
            if (Red5.getConnectionLocal() == null) {
                Red5.setConnectionLocal(instance.getConnection());
            }
            instance.invoke("setNewCursorPosition", new Object[] { x, y }, this);
        }
    } catch (NullPointerException npe) {
        //noop
    } catch (Exception err) {
        frame.setStatus("Exception: " + err);
        log.error("[sendCursorStatus]", err);
    }
}
BlueStacksMacPlatform.java 文件源码 项目:nanobot 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected void doLeftClick(final Point point) throws InterruptedException {
    // TODO non funziona
    final PointerInfo a = MouseInfo.getPointerInfo();
    final java.awt.Point b = a.getLocation();
    final int xOrig = (int) b.getX();
    final int yOrig = (int) b.getY();
    try {
        final Point p = clientToScreen(point);
        robot.mouseMove(p.x(), p.y());
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    } finally {
        robot.mouseMove(xOrig, yOrig);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号