Package jcurses.util

Examples of jcurses.util.Rectangle


   * @param width the width of bounds rectangle
   * @param height the width of bounds rectangle
   * @param color color attributes of the string
   */
  public static void printString(String text, int x, int y, int width, int height, CharColor color) {
    Rectangle rect = new Rectangle(x,y,width,height);
    printString(text,rect,color);
  }
View Full Code Here


   *
   * @param rectangle rectangle, whose colors are to be changed
   * @param colors new colors
   */
  public static void changeColors(Rectangle rect, CharColor color) {
    Rectangle clipRect = getCurrentClipRectangle();
    if (clipRect!=null) {
      rect = rect.intersection(clipRect);
    }
    if (!rect.isEmpty()) {
      changeColors(rect.getX(),rect.getY(),rect.getWidth(),rect.getHeight(), getColorPairNumber(color),
View Full Code Here

    * Is overrided by derived classes for example to implement a border.
    *
  */
 
  protected Rectangle getTextRectangle() {
    Rectangle result =  getSize();
    result.setLocation(getAbsoluteX(), getAbsoluteY());
    result.setHeight(result.getHeight());
    return result;
  }
View Full Code Here

    return getTextRectangle().getHeight();
  }
 
 
  private Rectangle getTextRectangle(int firstLine) {
     Rectangle rect = getTextRectangle();
     int y = ((firstLine - _firstLine)>=0)?(firstLine - _firstLine):0;
     rect.setLocation(rect.getX(), rect.getY()+y);
     rect.setHeight(rect.getHeight()-y);
     return rect;
  }
View Full Code Here

     return rect;
  }
 
 
  private Rectangle getLineRectangle(int firstLine) {
     Rectangle rect = getTextRectangle();
     int y = ((firstLine - _firstLine)>=0)?(firstLine - _firstLine):0;
     rect.setLocation(rect.getX(), rect.getY()+y);
     rect.setHeight(1);
     return rect;
  }
View Full Code Here

 
  /**
  *  Aus Widget
  */
  protected Rectangle getPreferredSize() {
    return new Rectangle(_width, _height);
  }
View Full Code Here

 
  }
 
 
  private void drawLine(int index) {
    Rectangle rect = getTextRectangle();
    CharColor colors = hasFocus()?getFocusedTextComponentColors():getColors();
    int firstLine = getFirstLineNumber();
    int firstChar = getFirstCharNumber();
    int pos = ((Integer)_lines.get(index)).intValue();
    int length = ((Integer)_lineLengths.get(index)).intValue();
    if ((firstChar < length) && ((index-firstLine) < rect.getHeight())) {
      int length2 = length - firstChar;
      int length3 = (length2 > rect.getWidth())?rect.getWidth():length2;
      Toolkit.printString(replaceTextLineForPrinting(_text.substring(pos+firstChar, pos+firstChar+length3)), rect.getX(), rect.getY()+index-firstLine, colors);
    }
  }
View Full Code Here

    drawBox(getTextRectangle());
  }
 
 
  private void changeColors() {
    Rectangle rect = getTextRectangle();
    CharColor colors = hasFocus()?getFocusedTextComponentColors():getColors();
    Toolkit.changeColors(rect, colors);
  }
View Full Code Here

    int index = __windowsStack.indexOf(w);
    if (!wasPartVisible(index)) {
      Toolkit.endPainting();
      return;
    }
    Rectangle rect = w.getRectangle();
    if (w.hasShadow()) {
      rect = ((Rectangle)rect.clone());
      rect.resize(rect.getWidth()+1, rect.getHeight()+1);
    }
    Toolkit.drawRectangle(rect, getScreenColors());
    for (int i=0; i<index; i++) {
      Window aw = __windowsStack.get(i);
      if (aw.isVisible()) {
        Rectangle rect2 = aw.getRectangle();
        if (aw.hasShadow()) {
          rect2 = ((Rectangle)rect2.clone());
          rect2.resize(rect2.getWidth()+1, rect2.getHeight()+1);
        }
        Rectangle clipRect = rect.intersection(rect2);
        if ((!clipRect.isEmpty()) && (isToBeRepainted(clipRect, i,index))) {
          Toolkit.setClipRectangle(clipRect);
          aw.repaint();
          Toolkit.unsetClipRectangle();
        }
      } 
View Full Code Here

 
  private static boolean wasPartVisible(int index) {
    boolean result = true;
    for (int i=index+1; i<__windowsStack.size(); i++) {
      Window aw = __windowsStack.get(index);
      Rectangle rect2 = aw.getRectangle();
      if (aw.hasShadow()) {
      rect2 = ((Rectangle)rect2.clone());
      rect2.resize(rect2.getWidth()+1, rect2.getHeight()+1);
      }
      Window aw1 = __windowsStack.get(i);
      if (aw1.isVisible() && (aw1.getRectangle().contains(rect2))) {
        result = false;
      break;
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.