java.awt.Canvas.getLocationOnScreen()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中java.awt.Canvas.getLocationOnScreen()方法的一些代码示例,展示了Canvas.getLocationOnScreen()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.getLocationOnScreen()方法的具体详情如下:
包路径:java.awt.Canvas
类名称:Canvas
方法名:getLocationOnScreen

Canvas.getLocationOnScreen介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

  1. @Override
  2. public void setCursorPosition (int x, int y) {
  3. if (robot != null) {
  4. robot.mouseMove(canvas.getLocationOnScreen().x + x, canvas.getLocationOnScreen().y + y);
  5. }
  6. }

代码示例来源:origin: libgdx/libgdx

  1. @Override
  2. public void setCursorPosition (int x, int y) {
  3. if (robot != null) {
  4. robot.mouseMove(canvas.getLocationOnScreen().x + x, canvas.getLocationOnScreen().y + y);
  5. }
  6. }

代码示例来源:origin: libgdx/libgdx

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

代码示例来源:origin: libgdx/libgdx

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

代码示例来源:origin: org.scijava/j3dcore

  1. @Override
  2. public Point getLocationOnScreen() {
  3. try {
  4. return super.getLocationOnScreen();
  5. }
  6. catch (IllegalComponentStateException e) {}
  7. return new Point();
  8. }

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

  1. @Override
  2. public void setCursorPosition (int x, int y) {
  3. if (robot != null) {
  4. robot.mouseMove(canvas.getLocationOnScreen().x + x, canvas.getLocationOnScreen().y + y);
  5. }
  6. }

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

相关文章