Package java.awt

Examples of java.awt.Rectangle


    if (mCache[row][0] != null) {
        height = mCache[row][0].getPreferredSize().height;
    }

    for (int i = 0; i < 2; i++) {
      Rectangle rect = table.getCellRect(row, i + 1, true);
      if (mProgramPanel[row][i] != null) {
        mProgramPanel[row][i].setWidth(rect.width);
        height = Math.max(height, mProgramPanel[row][i].getPreferredHeight());
      }
    }
View Full Code Here


      x = paintHeader(sel.get(i).toShortString(), x, y, g, headerMetric);
    }
   
    g.setFont(BODY_FONT);
    FontMetrics bodyMetric = g.getFontMetrics();
    Rectangle clip = g.getClipBounds();
    int firstRow = Math.max(0, (clip.y - y) / cellHeight - 1);
    int lastRow = Math.min(rowCount, 2 + (clip.y + clip.height - y) / cellHeight);
    int y0 = top + cellHeight + HEADER_SEP;
    x = left;
    for (int col = 0; col < columns; col++) {
View Full Code Here

    public void paintComponent(Graphics g) {

      Color oldColor = g.getColor();

      g.setColor(ScrollableMenu.this.getBackground());
      Rectangle rect = g.getClipBounds();
      g.fillRect(rect.x, rect.y, rect.width, rect.height);

      if (mIsMouseOver && mEnableScroll) {
        g.setColor(Color.blue);
      } else if (!mEnableScroll) {
View Full Code Here

  @Override
  public String getToolTipText(MouseEvent event) {
    final Point point = event.getPoint();
    int index = locationToIndex(point);
    if (index >= 0) {
      Rectangle bounds = getCellBounds(index, index);
      if (bounds != null) {
        int x = point.x - bounds.x;
        int y = point.y - bounds.y;
        Component component = getCellRenderer()
            .getListCellRendererComponent(this, mPrograms.elementAt(index),
View Full Code Here

    // Verschiebung nach links um Gesamtbreite (String) + ein Rand
    int x = getWidth() - this.borderWidth - w;
    // y = Absoluter Startpunkt für erste Textzeile
    int y = this.textComponent.getMargin().top + metrics.getAscent();

    Rectangle rect = g.getClipBounds();

    // Gesucht: 1. Absolute Textzeile die Sichtbar ist!
    if (rect.y > y) {
      y = (rect.y / h) * h + y;
    }
View Full Code Here

          y += iconHeight + ICON_DISTANCE_Y;
        }
      }
      // remember the size of this area for tooltip
      if (colCount == 1) {
        mInfoIconRect = new Rectangle(iconsTopLeft.x, iconsTopLeft.y, currentX
            - iconsTopLeft.x, y - iconsTopLeft.y);
      } else {
        mInfoIconRect = new Rectangle(iconsTopLeft.x, iconsTopLeft.y, maxWidth,
            y - iconsTopLeft.y + iconHeight);
      }
    }

    // Reset the old composite
View Full Code Here

      mCue = null;
    }
   
    if (mCue != null) {
      Point p = e.getLocation();
      Rectangle rect = mCue.getVisibleRect();
      int i = mCue.locationToIndex(p);
     
      if(i != -1) {
        Rectangle listRect = mCue.getCellBounds(mCue.locationToIndex(p),
            mCue.locationToIndex(p));
        Graphics2D g2 = (Graphics2D) mCue.getGraphics();
        boolean paint = false;
       
        if(listRect != null) {
          listRect.setSize(listRect.width,listRect.height/2);
          if(!listRect.contains(e.getLocation()) && !mSwitched && i == mOldIndex) {
            mCue.paintImmediately(mCueLine.getBounds());
            mCueLine.setRect(0,listRect.y + (listRect.height * 2) - 1,listRect.width,2);
            mSwitched = true;
            paint = true;
          }
          else if(listRect.contains(e.getLocation()) && i == mOldIndex && mSwitched) {
            mCue.paintImmediately(mCueLine.getBounds());
            mCueLine.setRect(0,listRect.y - 1,listRect.width,2);
            mSwitched = false;
            paint = true;
          }
          else if(i != mOldIndex && listRect.contains(e.getLocation())) {
            mCue.paintImmediately(mCueLine.getBounds());
            mCueLine.setRect(0,listRect.y - 1,listRect.width,2);
            mSwitched = false;
            mOldIndex = i;
            paint = true;
          }
          else if(i != mOldIndex && !listRect.contains(e.getLocation())) {
            mCue.paintImmediately(mCueLine.getBounds());
            mCueLine.setRect(0,listRect.y + (listRect.height * 2) - 1,listRect.width,2);
            mSwitched = true;
            mOldIndex = i;
            paint = true;
          }
          if(paint) {
            Color c = new Color(255,0,0,180);
            g2.setColor(c);
            g2.fill(mCueLine);
          }
        }
      }
      else {
        mOldIndex = -1;
        mCue.paintImmediately(mCueLine.getBounds());
      }
     
      if(p.y + 20 > rect.y + rect.height) {
        mCue.scrollRectToVisible(new Rectangle(p.x,p.y + 15,1,1));
      }
      if(p.y - 20 < rect.y) {
        mCue.scrollRectToVisible(new Rectangle(p.x,p.y - 15,1,1));
      }
    }
  }
View Full Code Here

        flavors[1].getHumanPresentableName().equals("Source")) {
      try {
        JList target = (JList)((DropTarget)e.getSource()).getComponent();
        int x = target.locationToIndex(e.getLocation());
       
        Rectangle rect = target.getCellBounds(x,x);
        if(rect != null) {
          rect.setSize(rect.width,rect.height/2);
       
          if(!rect.contains(e.getLocation())) {
            x++;
          }
        } else {
          x = 0;
        }
View Full Code Here

            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector();
       
        Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y);
       
        if (awtFont.getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
       
View Full Code Here

        }

        panel.hovered_element = currentlyHovered;

        boolean targetedRepaint = true;
        Rectangle repaintRegion = null;

        // If we moved out of the old block then unstyle it
        if (_previouslyHovered != null) {
            needRepaint = true;
            _previouslyHovered.restyle(c);

            PaintingInfo paintInfo = _previouslyHovered.getPaintingInfo();

            if (paintInfo == null) {
                targetedRepaint = false;
            } else {
                repaintRegion = new Rectangle(paintInfo.getAggregateBounds());
            }

            _previouslyHovered = null;
        }

        if (currentlyHovered != null) {
            needRepaint = true;
            Box target = box.getRestyleTarget();
            target.restyle(c);

            if (targetedRepaint) {
                PaintingInfo paintInfo = target.getPaintingInfo();

                if (paintInfo == null) {
                    targetedRepaint = false;
                } else {
                    if (repaintRegion == null) {
                        repaintRegion = new Rectangle(paintInfo.getAggregateBounds());
                    } else {
                        repaintRegion.add(paintInfo.getAggregateBounds());
                    }
                }
            }

            _previouslyHovered = target;
View Full Code Here

TOP

Related Classes of java.awt.Rectangle

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.