Package java.awt

Examples of java.awt.Point


   */
  public void selectItemAt(int pointX, int pointY) {
    // restore
    repaintCurrentCell();
    // select
    Point cellIndex = getMatrix(pointX,pointY);
    mCurrentCol = cellIndex.x;
    mCurrentRow = cellIndex.y;
    repaintCurrentCell();
  }
View Full Code Here


   * @param x X position of the point
   * @param y Y position of the point
   * @return Is the point at a selected program?
   */
  private boolean isSelectedItemAt(int x, int y) {
    Point cellIndex = getMatrix(x,y);
    return (mCurrentRow == cellIndex.y && mCurrentCol == cellIndex.x);
  }
View Full Code Here

    return 50;
  }

  @Override
  public String getToolTipText(MouseEvent event) {
    Point mousePoint = event.getPoint();
    Point panelIndex = getMatrix(mousePoint.x, mousePoint.y);
    if (panelIndex.x != -1) {
      ProgramPanel panel = mModel.getProgramPanel(panelIndex.x, panelIndex.y);

      // calculate relative mouse coordinates
      int currY = mLayout.getColumnStart(panelIndex.x);
      for (int row = 0; row < panelIndex.y; row++) {
        currY += mModel.getProgramPanel(panelIndex.x, row).getHeight();
      }
      final int panelX = mousePoint.x - panelIndex.x * mColumnWidth;
      final int panelY = mousePoint.y - currY;
      StringBuilder buffer = new StringBuilder();
      String tooltip = panel.getToolTipText(panelX, panelY);
      if (tooltip != null && tooltip.length() > 0) {
        buffer.append(tooltip);
      }

      // if program is partially not visible then show the title as tooltip
      final JViewport viewport = MainFrame.getInstance()
          .getProgramTableScrollPane().getViewport();
      Point viewPos = viewport.getViewPosition();
      Dimension viewSize = viewport.getSize();
      final Program program = panel.getProgram();
      if ((currY < viewPos.y)
          || (panelIndex.x * mColumnWidth + panel.getTitleX() < viewPos.x)
          || ((panelIndex.x + 1) * mColumnWidth - 1 > viewPos.x
View Full Code Here

        }
        else if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
          if(getSelectionPath() != null) {
            Rectangle pathBounds = getRowBounds(getRowForPath(getSelectionPath()));

            showContextMenu(new Point(pathBounds.x + pathBounds.width - 10, pathBounds.y + pathBounds.height - 5));
          }
        }
        else if(e.getKeyCode() == KeyEvent.VK_F2) {
          if(getSelectionPath() != null) {
            FavoriteNode node = (FavoriteNode)getSelectionPath().getLastPathComponent();
View Full Code Here

    mTrayParent.setVisible(true);
    mTrayParent.toFront();

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        Point p2 = computeDisplayPoint(p.x,p.y,mPopupMenu.getPreferredSize());

        mPopupMenu.show(mTrayParent,p2.x - mTrayParent.getLocation().x,p2.y - mTrayParent.getLocation().y);
      }
    });
  }
View Full Code Here

        x -= dim.width;
      }
      if (y - dim.height > 0) {
        y -= dim.height;
      }
      return new Point(x, y);
  }
View Full Code Here

                int nXPos = (i * imGray.getWidth()) / imShrunk.getWidth();
                for (int j=0; j<imShrunk.getHeight()-this.hcc.getHeight(); j+=nStepVert) {
                    // compute top coordinate of in original image
                    int nYPos = (j * imGray.getHeight()) / imShrunk.getHeight();
                    // compute rectangle center in original image
                    Point p = new Point(
                            nXPos + (this.hcc.getWidth() * imGray.getWidth()) /
                                        imShrunk.getWidth() / 2,
                            nYPos + (this.hcc.getHeight() * imGray.getHeight()) /
                                        imShrunk.getHeight() / 2);
                    // check if this point has already been tested
View Full Code Here

  JViewport vp = (JViewport)e.getSource();
  int h = vp.getViewSize().height;
  if (h != lastHeight) { // i.e. an addition not just a user scrolling
    lastHeight = h;
    int x = h - vp.getExtentSize().height;
    vp.setViewPosition(new Point(0, x));
  }
      }
    });   

    JPanel mondo = new JPanel();
View Full Code Here

  public UserAwayDetector() {
    mAwaySince = System.currentTimeMillis();
  }

  public boolean isAway() {
    Point mousePos = MouseInfo.getPointerInfo().getLocation();
    long currentTime = System.currentTimeMillis();
    if (!mousePos.equals(mLastMousePos)) {
      mAwaySince = currentTime;
    }
    mLastMousePos = mousePos;
    return (currentTime - mAwaySince > 1800.0 * 1000.0);
  }
View Full Code Here

          saveSearchFormSettings();
        }
      }
    });

    Point p = mSearchButton.getLocationOnScreen();

    if(MainFrame.getInstance().getToolbar().getToolbarLocation().compareTo(BorderLayout.NORTH) == 0) {
      configure.setLocation(p.x - configure.getWidth() + mSearchButton.getWidth(),p.y + mSearchButton.getHeight());
    } else {
      configure.setLocation(p.x ,p.y - configure.getHeight());
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.