Package java.awt

Examples of java.awt.Point


   * Use the 1.5 API to get the cursor position relative to the component. Return null
   * if it fails (JDK <= 1.4).
   */
  public static Point getCursorPosition(Component component) {
    try {
      Point pointer_location = getPointerLocation(component);
      if (pointer_location != null) {
        Point location = component.getLocationOnScreen();
        pointer_location.translate(-location.x, -location.y);
        pointer_location.move(pointer_location.x, transformY(component, pointer_location.y));
        return pointer_location;
      }
    } catch (IllegalComponentStateException e) {
View Full Code Here


  }

  public static void setCursorPosition(Component component, Robot robot, int x, int y) {
    if (robot != null) {
      try {
        Point location = component.getLocationOnScreen();
        int transformed_x = location.x + x;
        int transformed_y = location.y + transformY(component, y);
        robot.mouseMove(transformed_x, transformed_y);
      } catch (IllegalComponentStateException e) {
        LWJGLUtil.log("Failed to set cursor position: " + e);
View Full Code Here

    int[] pixels = new int[images.remaining()];
    int old_position = images.position();
    images.get(pixels);
    images.position(old_position);
    cursor_image.setRGB(0, 0, width, height, pixels, 0, width);
    return Toolkit.getDefaultToolkit().createCustomCursor(cursor_image, new Point(xHotspot, yHotspot), "LWJGL Custom cursor");
  }
View Full Code Here

    {
      // ignore ... will fail if this is not a JDK 1.4 ..
    }

    final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
    return new Point(s.width / 2, s.height / 2);
  }
View Full Code Here

    }

    @Override
    public int getFirstVisibleIndex() {
        Rectangle viewRect = getVisibleRect();
        return rowAtPoint(new Point(0, viewRect.y));
    }
View Full Code Here

    }

    @Override
    public int getLastVisibleIndex() {
        Rectangle viewRect = getVisibleRect();
        return rowAtPoint(new Point(0, viewRect.y + viewRect.height - 1));
    }
View Full Code Here

    public boolean generate(Projection proj) {
        needToRegenerate = false;

        switch (renderType) {
        case RENDERTYPE_XY:
            point1 = new Point(eunit.p1.x, eunit.p1.y);
            break;
        case RENDERTYPE_OFFSET:
            point1 = proj.forward(eunit.ll1.lat, eunit.ll1.lon);
            point1.x += eunit.p1.x;
            point1.y += eunit.p1.y;
View Full Code Here

            AttributeSet style = (AttributeSet)styleMap.get(NORMALBLACK);
            getLogDoc().insertString(getLogDoc().getLength(),
                    msg +  "\n" ,style);
           
            //Point pt1=logTextPane.getLocation();
            Point pt2 = new Point((int)(0),
                    (int)(logTextPane.getBounds().getHeight()));
            logTextScrollPane.getViewport().setViewPosition(pt2);
        } catch(Exception e) {
            logger.warning("Error: "+e);
        }
View Full Code Here

      } else {
        checkForSmile(message, style);
        getChatDoc().insertString(getChatDoc().getLength(), "\n", style);
      }
           
            Point pt1 = chatRoomTextPane1.getLocation();
            Point pt2 = new Point((int)(0),
                    (int)(chatRoomTextPane1.getBounds().getHeight()));
            chatRoomScrollPane.getViewport().setViewPosition(pt2);
        } catch(Exception e) {
            logger.warning("Error: "+e);
        }
View Full Code Here

            dim.height = (dim.height - windowSize.height) / 2;
            dim.width = (dim.width - windowSize.width) / 2;
        } else {
            // relative to the mainframe
            dim = tk.getScreenSize();
            Point p = DataCrow.mainFrame.getLocation();
            dim.height = (p.y) + ((DataCrow.mainFrame.getSize().height - windowSize.height / 2);
            dim.width = (p.x) + ((DataCrow.mainFrame.getSize().width - windowSize.width ) / 2);
        }

        return new Point(dim.width, dim.height);
    }
View Full Code Here

TOP

Related Classes of java.awt.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.