Package jcurses.util

Examples of jcurses.util.Rectangle


    Toolkit.drawRectangle(rect, getColors());
  }
 
 
  private void drawItems() {
    Rectangle rect = (Rectangle)getSize().clone();
    rect.setLocation(getAbsoluteX(), getAbsoluteY());
    for (int i=0; i<getVisibleSize(); i++) {
      int index = _startIndex +i;
      if ( index < _items.size()) {
        printItem(index, rect);
      } else {
        Toolkit.drawRectangle(new Rectangle(rect.getX()+1,rect.getY()+i+1,rect.getWidth()-2,1),getColors());
      }
    }
    if (_items.size() == 0) {
      drawFirstRowSelected();
    }
View Full Code Here


    }
  }
 
 
  protected void doPaint() {
    Rectangle rect = (Rectangle)getSize().clone();
    rect.setLocation(getAbsoluteX(), getAbsoluteY());
    Toolkit.drawBorder(rect, getColors());
    drawTitle();
    _scrollbars.paint();
    drawRectangle();
    drawItems()
View Full Code Here

 
  private void redrawItem(int index, Rectangle rect) {
    int x = rect.getX()+1;
    int y = rect.getY()+1+index-_startIndex;
    int width = rect.getWidth()-2;
    Rectangle itemRect = new Rectangle(x,y,width,1);
    boolean toSelect = (((index == _trackedIndex) && hasFocus()) ||
              (isSelected(index)));
    CharColor colors = toSelect?getSelectedItemColors():getColors();
    Toolkit.changeColors(itemRect,colors);
   
View Full Code Here

  }
 
 
 
  public Rectangle getBorderRectangle() {
    Rectangle rect = (Rectangle)getSize().clone();
    rect.setLocation(getAbsoluteX(), getAbsoluteY());
    return rect;
  }
View Full Code Here

  private static Rectangle getCurrentClipRectangle() {
    ArrayList clips = (ArrayList)__clips.get(Thread.currentThread());
    if ((clips == null) || (clips.size()==0)) {
      return null;
    }
    Rectangle result = (Rectangle)clips.get(0);
    for (int i=1; i<clips.size(); i++) {
      Rectangle temp = (Rectangle)clips.get(i);
      result = result.intersection(temp);
      if (result.isEmpty()) {
        return result;
      }
    }
View Full Code Here

   *
   * @param rect rectangle ( that is, bounds of rectangle) to be painted
   * @param color color to fill the rectangle, only background part is used
   */
  public static void drawRectangle(Rectangle rect, CharColor color) {
    Rectangle clipRect = getCurrentClipRectangle();
    if (clipRect!=null) {
      rect = rect.intersection(clipRect);
    }
    if (!rect.isEmpty()) {
      drawRectangle(rect.getX(),rect.getY(),rect.getWidth(),rect.getHeight(),
View Full Code Here

   * @param width the width of the rectangle to be painted
   * @param heigtht the height of the rectangle to be painted
   * @param color color to fill the rectangle, only background part is used
   */
  public static void drawRectangle(int x, int y, int width, int height, CharColor color) {
    Rectangle rect = new Rectangle(x,y,width,height);
    drawRectangle(rect, color);
   
  }
View Full Code Here

   * the corner point (alignment == 0 ) or <bold>OVER</bold> (alignment == 1), or the corner char, if the corner has no sides, it.
   * @color the color attributes for of the corner
   *
   */
  public static void drawCorner(int startX, int startY, int endX, int endY, CharColor color, short alignment) {
    Rectangle clipRect = getCurrentClipRectangle();
    if ((clipRect == null)) {
      drawCorner(startX, startY, endX, endY, getColorPairNumber(color),
                 __attributes[color.getColorAttribute()], alignment);
    } else {
      Point center = getCornerCenterPoint(startX,startY,endX,endY,alignment);
      if ((alignment == CORNER_UNDER_LINE) || (alignment == CORNER_OVER_LINE)) {
        LinePart verticalPart = null;
        LinePart horizontalPart = null;
        if (startX == center.x) {
          int endY2 = (startY < center.y)?(center.y-1):(center.y+1);
          verticalPart = new LinePart(startY,endY2,center.x,VERTICAL);
          int endX2 = (endX < center.x)?(center.x-1):(center.x+1);
          horizontalPart = new LinePart(endX,endX2,center.y,HORIZONTAL);
        } else {
          int endY3 = (endY < center.y)?(center.y-1):(center.y+1);
          verticalPart = new LinePart(endY,endY3,center.x,VERTICAL);
          int endX3 = (startX < center.x)?(center.x-1):(center.x+1);
          horizontalPart = new LinePart(startX,endX3,center.y,HORIZONTAL);
        }
     
        drawHorizontalLine(horizontalPart._begin,horizontalPart._position,horizontalPart._end,color);
        drawVerticalLine(verticalPart._position,verticalPart._begin,verticalPart._end,color);
      }
     
     
      if (clipRect.inside(center.x,center.y)) {
        if ((alignment != CORNER_UNDER_LINE) && (alignment!=CORNER_OVER_LINE)) {
          drawCorner(center.x, center.y, center.x, center.y, getColorPairNumber(color),
                     __attributes[color.getColorAttribute()], alignment);
        } else {
          short newAlignment = getCornerChar(startX,startY,endX,endY,alignment);
View Full Code Here

   * @param rectangle the rectangle, within which the string must lie. If the string
   * doesn't fit within the rectangle it will be broken.
   * @param colr attributes of the string
   */
  public static void printString(String text, Rectangle rect, CharColor color) {
    Rectangle clipRect = getCurrentClipRectangle();
    if (clipRect!=null) {
      Rectangle newRect = rect.intersection(clipRect);
      if (!newRect.isEmpty()) {
        printClippedString(rect, newRect, text, color);
      }
    } else {
      printStringWithoutClipping(text, rect,color)
    }
View Full Code Here

            line = line.substring(beginPart,line.length());
            if (line.length() > newRect.getWidth()) {
              line = line.substring(0,newRect.getWidth());
            }
            //Zeichnen
            Rectangle paintRect = new Rectangle(newRect.getX(),oldRect.getY()+i,line.length(),1);
            printStringWithoutClipping(line,paintRect,color);
          }
           
        }
      }
View Full Code Here

TOP

Related Classes of jcurses.util.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.