Package java.awt

Examples of java.awt.Rectangle


      }
    }

    // Using the information of the clip bounds, we can speed up painting
    // significantly
    Rectangle clipBounds = grp.getClipBounds();

    // Paint the table cells
    int minCol = clipBounds.x / mColumnWidth;
    if (minCol < 0) {
      minCol = 0;
    }
    int maxCol = (clipBounds.x + clipBounds.width) / mColumnWidth;
    int columnCount = mModel.getColumnCount();
    if (maxCol >= columnCount) {
      maxCol = columnCount - 1;
    }

    // Paint the background
    super.paintComponent(grp);
    int tableHeight = Math.max(mHeight, clipBounds.y + clipBounds.height);
    mBackgroundPainter.paintBackground(grp, mColumnWidth, tableHeight,
        minCol, maxCol, clipBounds, mLayout, mModel);

    boolean mouseOver = false;

    int x = minCol * mColumnWidth;
    for (int col = minCol; col <= maxCol; col++) {
      int y = mLayout.getColumnStart(col);

      int rowCount = mModel.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
        // Get the program
        ProgramPanel panel = mModel.getProgramPanel(col, row);

        // Render the program
        if (panel != null) {
          int cellHeight = panel.getHeight();

          // Check whether the cell is within the clipping area
          if (((y + cellHeight) > clipBounds.y)
              && (y < (clipBounds.y + clipBounds.height))) {

            Rectangle rec = new Rectangle(x, y, mColumnWidth, cellHeight);
            if (Settings.propProgramTableMouseOver.getBoolean()) {
              if ((mMouse != null) && (rec.contains(mMouse))) {
                mouseOver = true;
              } else {
                mouseOver = false;
              }
            }

            // calculate clipping intersection between global clip border and current cell rectangle
            Shape oldClip = grp.getClip();
            rec = rec.intersection((Rectangle)oldClip);

            // Paint the cell
            if (rec.width > 0 || rec.height > 0) {
              grp.setClip(rec);
              grp.translate(x, y);
View Full Code Here


   */
  private void repaintCell(final Point cellIndex) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        if ((cellIndex.x >= 0 || cellIndex.y >= 0) && cellIndex.x < mModel.getColumnCount()) {
          Rectangle cellRect = getCellRect(cellIndex.x, cellIndex.y);
          if (cellRect != null) {
            repaint(cellRect);
          }
        }
      }
View Full Code Here

    int rowCount = mModel.getRowCount(cellCol);
    for (int row = 0; row < rowCount; row++) {
      ProgramPanel panel = mModel.getProgramPanel(cellCol, row);
      int height = panel.getHeight();
      if (row == cellRow) {
        return new Rectangle(x, y, width, height);
      }
      y += height;
    }

    // Invalid cell
View Full Code Here

  }



  public void tableCellUpdated(int col, int row) {
    Rectangle cellRect = getCellRect(col, row);
    if (cellRect != null) {
      repaint(cellRect);
    }
  }
View Full Code Here

    if(mCurrentCol == -1 || mCurrentRow == -1) {
      return;
    }

    Program program = mModel.getProgramPanel(mCurrentCol, mCurrentRow).getProgram();
    Rectangle rect = this.getCellRect(mCurrentCol,mCurrentRow);
    scrollRectToVisible(rect);

    mPopupMenu = createPluginContextMenu(program);
    mPopupMenu.show(this, rect.x + (rect.width / 3), rect.y + ((rect.height * 3) / 4));

View Full Code Here

    do {
      int rows = mModel.getRowCount(mCurrentCol);

      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);
View Full Code Here

        }

        int rows = mModel.getRowCount(mCurrentCol);

        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);
View Full Code Here

  }

  private void scrollToSelection() {
    int height = getVisibleRect().height;
    int width = getVisibleRect().width;
    Rectangle cell = getCellRect(mCurrentCol,mCurrentRow);

    if(cell.height > height) {
      cell.setSize(cell.width,height);
    }
    if(cell.width > width) {
      cell.setSize(width,cell.height);
    }

    this.scrollRectToVisible(cell);
  }
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) {
View Full Code Here

    mCueLine.setRect(0,0,0,0);
    mTarget = -2;
  }

  private int getTargetFor(FavoriteNode node, Point p, int row) {
    Rectangle location = getRowBounds(getClosestRowForLocation(p.x, p.y));

    if(node.isDirectoryNode()) {
      if(row != getRowCount() && p.y - location.y <= (location.height / 4)) {
        return -1;
      }
View Full Code Here

TOP

Related Classes of java.awt.Rectangle

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.