Package jcurses.util

Examples of jcurses.util.Rectangle


   * @param border true, if the window has a border, false in other case
   */
  public Window (int x, int y, int width, int height, boolean border, String title) {
    _border = border;
    _title = title;
    _rect = new Rectangle(width, height);
    _rect.setLocation(x, y);
   
    int x1 = border?x+1:x;
    int y1 = border?y+1:y;
    int w = border?width-2:width;
    int h = border?height-2:height;
   
    _root = new Panel(w, h);
    _root.setSize(new Rectangle(w, h));
    _root.setX(x1);
    _root.setY(y1);
    _root.setWindow(this);
    WindowManager.createWindow(this);
  }
View Full Code Here


    int x1 = _border?x+1:x;
    int y1 = _border?y+1:y;
    int w =  _border?width-2:width;
    int h =  _border?height-2:height;
   
    _root.setSize(new Rectangle(w, h));
    _root.setX(x1);
    _root.setY(y1);
   
  }
View Full Code Here

 
 
 
  // methods to compare widget positions
  static boolean toTheLeftOf(Widget widget1, Widget widget2) {
    Rectangle rect1 = widget1.getRectangle();
    Rectangle rect2 = widget2.getRectangle();
    boolean result = ((rect1.getX()+rect1.getWidth()-1) < rect2.getX());
    return result;
  }
View Full Code Here

    return result;
  }
 

  static boolean toTheRightOf(Widget widget1, Widget widget2) {
    Rectangle rect1 = widget1.getRectangle();
    Rectangle rect2 = widget2.getRectangle();
    boolean result = ((rect1.getX()) > (rect2.getX()+rect2.getWidth()-1));
    return  result;
  }
View Full Code Here

    boolean result = ((rect1.getX()) > (rect2.getX()+rect2.getWidth()-1));
    return  result;
  }
 
  static boolean atTheTopOf(Widget widget1, Widget widget2) {
    Rectangle rect1 = widget1.getRectangle();
    Rectangle rect2 = widget2.getRectangle();
    boolean result = ((rect1.getY()+rect1.getHeight()-1) < rect2.getY());
    return result;
  }
View Full Code Here

    boolean result = ((rect1.getY()+rect1.getHeight()-1) < rect2.getY());
    return result;
  }
 
  static boolean atTheBottomOf(Widget widget1, Widget widget2) {
    Rectangle rect1 = widget1.getRectangle();
    Rectangle rect2 = widget2.getRectangle();
    boolean result = ((rect1.getY()) > (rect2.getY()+rect2.getHeight()-1));
    return  result;
  }
View Full Code Here

    boolean result = ((rect1.getY()) > (rect2.getY()+rect2.getHeight()-1));
    return  result;
  }
 
  static int getDistance(Widget widget1, Widget widget2) {
    Rectangle rect1 = widget1.getRectangle();
    Rectangle rect2 = widget2.getRectangle();
    int x1 = rect1.getX()+(rect1.getWidth()/2);
    int y1 = rect1.getY()+(rect1.getHeight()/2);
    int x2 = rect2.getX()+(rect2.getWidth()/2);
    int y2 = rect2.getY()+(rect2.getHeight()/2);
   
    return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
   
  }
 
View Full Code Here

  }
 
 
 
  protected Rectangle getPreferredSize() {
    return new Rectangle(-1,(_visibleSize < 0)?-1:_visibleSize+2);
  }
View Full Code Here

    return result;
  }
 
 
  private int getMaxStartPos() {
    Rectangle rect = (Rectangle)getSize().clone();
    int width = rect.getWidth()-2;
    int result = getMaxLength() - width;
    result = (result < 0)?0:result;
   
    return result;
   
View Full Code Here

  }
 
 
 
  private void drawRectangle() {
    Rectangle rect = (Rectangle)getSize().clone();
    rect.setWidth(rect.getWidth()-2);
    rect.setHeight(rect.getHeight()-2);
    rect.setLocation(getAbsoluteX()+1, getAbsoluteY()+1);
    Toolkit.drawRectangle(rect, getColors());
  }
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.