Package java.awt

Examples of java.awt.Rectangle



  private boolean calculateCueLine(Point p) {
    int row = getClosestRowForLocation(p.x, p.y);

    Rectangle rowBounds = getRowBounds(row);

    if(rowBounds.y + rowBounds.height < p.y) {
      row = this.getRowCount();
    }

    TreePath path = getPathForRow(row);

    if(path == null) {
      path = new TreePath(mRootNode);
    }

    if(mTransferNode != null && !new TreePath(mTransferNode.getPath()).isDescendant(path)) {
      FavoriteNode last = (FavoriteNode)path.getLastPathComponent();
      FavoriteNode pointed = last;

      int target = getTargetFor(pointed, p, row);

      if(target == -1 || (target == 1 && !isExpanded(new TreePath(pointed.getPath())))) {
        if(!last.isRoot()) {
          last = (FavoriteNode)last.getParent();
        }
      }

      if(mTarget == 0 && (System.currentTimeMillis() - mDragOverStart) > 1000 && isCollapsed(new TreePath(last.getPath())) && last.getChildCount() > 0) {
        expandPath(new TreePath(last.getPath()));

        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            mTarget = -2;
          }
        });
      }

      if(mTargetNode != last || mTarget != target) {
        mTargetNode = last;
        mTarget = target;
        mDragOverStart = System.currentTimeMillis();

        this.paintImmediately(mCueLine.getBounds());

        int y = row != getRowCount() ? rowBounds.y : rowBounds.y + rowBounds.height;

        if(target == -1) {
          Rectangle rect = new Rectangle(rowBounds.x,y-1,rowBounds.width,2);

          mCueLine.setRect(rect);
        }
        else if(target == 0) {
          Rectangle rect = new Rectangle(rowBounds.x,rowBounds.y,rowBounds.width,rowBounds.height);

          mCueLine.setRect(rect);
        }
        else if(target == 1) {
          Rectangle rect= new Rectangle(rowBounds.x,y + rowBounds.height-1,rowBounds.width,2);

          if(row == getRowCount()) {
           rect = new Rectangle(0,y-1,getWidth(),2);
          }
          mCueLine.setRect(rect);
        }

        Graphics2D g2 = (Graphics2D) getGraphics();
View Full Code Here


    if (this.getVisibleRect().width < this.getSize().width
        || this.getVisibleRect().height < this.getSize().height) {
      int scroll = 20;
      if (e.getLocation().y + scroll + 5 > getVisibleRect().height) {
        scrollRectToVisible(new Rectangle(e.getLocation().x, e.getLocation().y
            + scroll + 5, 1, 1));
      }
      if (e.getLocation().y - scroll < getVisibleRect().y) {
        scrollRectToVisible(new Rectangle(e.getLocation().x, e.getLocation().y
            - scroll, 1, 1));
      }
      if (e.getLocation().x - scroll < getVisibleRect().x) {
        scrollRectToVisible(new Rectangle(e.getLocation().x - scroll, e
            .getLocation().y, 1, 1));
      }
      if (e.getLocation().x + scroll + 5 > getVisibleRect().width) {
        scrollRectToVisible(new Rectangle(e.getLocation().x + scroll + 5, e
            .getLocation().y, 1, 1));
      }
    }
  }
View Full Code Here

                                this.hcc.getHeight());
                        gcc.push(imShrunk);
                        // see if there's a face there
                        if (hcc.eval(gcc.getFront())) {
                            // there is, add scaled rectangle to rectangle list
                            Rectangle r = new Rectangle(
                                    nXPos,
                                    nYPos,
                                    (this.hcc.getWidth() * imGray.getWidth()) /
                                        imShrunk.getWidth(),
                                    (this.hcc.getHeight() * imGray.getHeight()) /
                                        imShrunk.getHeight());
                            System.out.println("Found something " + r.toString());
                            this.rc.add(r);
                        }
                    }
                }
            }
View Full Code Here

        Gray8Image imMask = new Gray8Image(
                imGray.getWidth(),
                imGray.getHeight(),
                Byte.MIN_VALUE);
        for (Enumeration<Rectangle> e = rc.elements(); e.hasMoreElements();) {
            Rectangle r = e.nextElement();
            Gray8Rect gr = new Gray8Rect(r, Byte.MAX_VALUE);
            gr.push(imMask);
            imMask = (Gray8Image) gr.getFront();
        }
        // Stretch imMask to original image size; this is the result
View Full Code Here

    private static final long serialVersionUID = -3124434678426673334L;

    public void paintComponent(Graphics g) {

      Insets i = this.getInsets();
      Rectangle box = new Rectangle(i.left, i.top,
            this.getWidth() - i.right,
            this.getHeight() - i.bottom );
      g.setColor(isSelected
           ? list.getSelectionBackground()
           : list.getBackground());
View Full Code Here

  /**
   * Ensures the rectangle which displays rows from <code>minIndex</code> to <code>maxIndex</code> is visible.
   */
  private void makeRowsVisible(int minRow, int maxRow) {   
    // Compute the rectangle that includes a row
    Rectangle includingRectangle = getCellRect(minRow, 0, true);
    if (minRow != maxRow) {
      includingRectangle = includingRectangle.
          union(getCellRect(maxRow, 0, true));     
    }
    if (getAutoResizeMode() == AUTO_RESIZE_OFF) {
      int lastColumn = getColumnCount() - 1;
      includingRectangle = includingRectangle.
          union(getCellRect(minRow, lastColumn, true));
      if (minRow != maxRow) {
        includingRectangle = includingRectangle.
            union(getCellRect(maxRow, lastColumn, true));     
      }
    }
    scrollRectToVisible(includingRectangle);
  }
View Full Code Here

    public void actionPerformed(ActionEvent e){
        Component[] comp = toolbar.getComponents();
        Action[] actions = DefaultToolBarModel.getInstance().getActions();

        Rectangle visibleRect = toolbar.getVisibleRect();
        for(int i = 0; i<comp.length; i++){
            if(!isVisible(comp[i], visibleRect)){
                mPopupMenu = new JPopupMenu();
                for(; i<comp.length; i++){
                    if(comp[i] instanceof AbstractButton) {
View Full Code Here

      if (c != null) {
        JPanel toolBarPanel = MainFrame.getInstance().getToolBarPanel();

        Point p = SwingUtilities.convertPoint(toolBarPanel, location, c);

        Rectangle oldCueLineBounds = mCueLine.getBounds();

        if (mWest) {
          mCueLine.setRect(1,
              (p.y < c.getHeight() / 2) ? (location.y - p.y) : (location.y
                  + c.getHeight() - p.y), toolBarPanel.getWidth() - 1, 2);
        } else {
          mCueLine.setRect((p.x < c.getWidth() / 2) ? (location.x - p.x )
              : (location.x + c.getWidth() - p.x ), 1, 2,
              toolBarPanel.getHeight() - 1);
        }

        if (!oldCueLineBounds.equals(mCueLine.getBounds())) {
          Graphics2D g2d = (Graphics2D) toolBarPanel.getGraphics();
          toolBarPanel.paintImmediately(oldCueLineBounds);

          Color color = new Color(255, 0, 0, 180);
          g2d.setColor(color);
View Full Code Here

    instance = new ProgramInfoDialog(instance.mActionsPane.getPreferredSize(),
        instance.mShowSettings);
  }

  protected void addPluginActions(boolean rebuild) {
    final Rectangle oldVisibleRect = mInfoEP.getVisibleRect();
    mFunctionGroup.removeAll();

    if (ProgramInfo.getInstance().getSettings().getShowSearchButton()) {
      mTextSearch = new TaskMenuAction(mFunctionGroup, mProgram, mSearchMenu,
          this, "id_sea", mFindAsYouType);
View Full Code Here

      public void windowOpened(WindowEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            mMainPanel.repaint();
            mInfoEP.scrollRectToVisible(new Rectangle(0, 0));
          }
        });
      }
    });
  }
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.