Package java.awt

Examples of java.awt.Point


            && Settings.propProgramTableMouseAutoScroll.getBoolean()
            && (System.currentTimeMillis() - mLastDragTime < 20)) {
          if (Math.abs(mLastDragDeltaX) >= 3 || Math.abs(mLastDragDeltaY) >= 3) {
            // stop last scroll, if it is still active
            stopAutoScroll();
            startAutoScroll(new Point(mLastDragDeltaX, mLastDragDeltaY), 2);
          }
        }

        // disable dragging
        mDraggingPoint = null;
View Full Code Here



  public void scrollBy(int deltaX, int deltaY) {
    if (getParent() instanceof JViewport) {
      JViewport viewport = (JViewport) getParent();
      Point oldViewPos = viewport.getViewPosition();
      Point viewPos = new Point(oldViewPos.x, oldViewPos.y);
      if (deltaX!=0){
        viewPos.x += deltaX;
        int maxX = getWidth() - viewport.getWidth();

        viewPos.x = Math.min(viewPos.x, maxX);
        viewPos.x = Math.max(viewPos.x, 0);
      }
      if (deltaY !=0){
        viewPos.y += deltaY;
        int maxY = getHeight() - viewport.getHeight();

        viewPos.y = Math.min(viewPos.y, maxY);
        viewPos.y = Math.max(viewPos.y, 0);
      }
      if (viewPos.equals(oldViewPos)) {
        stopAutoScroll();
      } else {
        viewport.setViewPosition(viewPos);
      }
    }
View Full Code Here

        mClickThread.start();
      }
    }

    mDraggingPoint = evt.getPoint();
    mDraggingPointOnScreen = new Point(evt.getXOnScreen(), evt.getYOnScreen());
  }
View Full Code Here

        mLastDragDeltaY = mDraggingPoint.y - evt.getY();
        scrollBy(mLastDragDeltaX, mLastDragDeltaY);
        mLastDragTime = System.currentTimeMillis();
      } else if (SwingUtilities.isMiddleMouseButton(evt)
          && mDraggingPointOnScreen != null) {
        Point scroll = new Point(evt.getXOnScreen() - mDraggingPointOnScreen.x,
            evt.getYOnScreen() - mDraggingPointOnScreen.y);
        startAutoScroll(scroll, 10);
      }
    }
  }
View Full Code Here

  private void handleMouseMoved(MouseEvent evt) {
    if (Settings.propProgramTableMouseOver.getBoolean()) {
      if ((mPopupMenu == null) || (!mPopupMenu.isVisible())) {
        mMouse = evt.getPoint();
        Point cellIndex = getMatrix(mMouse.x, mMouse.y);
        // restore previous panel under mouse
        repaintCell(mMouseMatrix);
        if (cellIndex.x >= 0 && cellIndex.y >= 0) {
          if (cellIndex.x != mMouseMatrix.x || cellIndex.y != mMouseMatrix.y) {
            // now update the current panel
View Full Code Here

  /**
   * repaint the currently selected cell (keyboard selection)
   * @since 2.6
   */
  private void repaintCurrentCell() {
    repaintCell(new Point(mCurrentCol, mCurrentRow));
  }
View Full Code Here

    if (Settings.propProgramTableMouseOver.getBoolean()) {
      JViewport viewport = (JViewport) getParent();
      if (((mPopupMenu == null) || (!mPopupMenu.isVisible())) && !viewport.getViewRect().contains(evt.getPoint())) {
        repaintCell(mMouseMatrix);
        mMouse = null;
        mMouseMatrix = new Point(-1, -1);
      }
    }
  }
View Full Code Here

      if(previousCol != -1 && rows > 0) {
        Rectangle rectPrev = getCellRect(previousCol,mCurrentRow);
        Rectangle rectCur = getCellRect(mCurrentCol,1);

        if(rectCur != null && rectPrev != null) {
          Point cellIndex = getMatrix(rectCur.x, mCurrentY);
          if(cellIndex.y != -1) {
            ProgramPanel panel = mModel.getProgramPanel(cellIndex.x, cellIndex.y);
            if(panel != null && !panel.getProgram().isExpired()) {
              find = false;
              found = true;
View Full Code Here

        if(previousCol != -1 && rows > 0) {
          Rectangle rectPrev = getCellRect(previousCol,mCurrentRow);
          Rectangle rectCur = getCellRect(mCurrentCol,1);

          if(rectCur != null && rectPrev != null) {
            Point cellIndex = getMatrix(rectCur.x, mCurrentY);
            if(cellIndex.y != -1) {
              ProgramPanel panel = mModel.getProgramPanel(cellIndex.x, cellIndex.y);
              if(panel != null && !panel.getProgram().isExpired()) {
                find = false;
                found = true;
View Full Code Here

   */
  private Point getMatrix(int pointX, int pointY) {
    int col = pointX / mColumnWidth;

    if ((col < 0) || (col >= mModel.getColumnCount())) {
      return new Point(-1, -1);
    }
    int currY = mLayout.getColumnStart(col);
    if (pointY < currY) {
      return new Point(-1, -1);
    }

    int rowCount = mModel.getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
      ProgramPanel panel = mModel.getProgramPanel(col, row);
      currY += panel.getHeight();
      if (pointY < currY) {
        return new Point(col, row);
      }
    }

    return new Point(-1, -1);
  }
View Full Code Here

TOP

Related Classes of java.awt.Point

Copyright © 2015 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.