Пример #1
0
  public void moveDown(TextAppearance appearance) {
    synchronized (content) {
      if (activeLine == null) return;

      Point currentPos = activeLine.getActivePosition(appearance);

      if (activeLine.getSelectedLine() != null) {
        currentPos.setY(
            activeLineY + currentPos.getY() + (activeLine.getSelectedLine().getSize().getHeight()));
        if (currentPos.getY() > getSize().getHeight()) {
          currentPos.setY(getSize().getHeight());
        }
        activeAtom = findAtomOnPosition(currentPos.getX(), currentPos.getY(), appearance);
        setActiveAtom(this.activeAtom);
      }
    }
  }
Пример #2
0
 public Point getActivePosition(TextAppearance appearance) {
   synchronized (content) {
     if (activeLine != null) {
       Point result = activeLine.getActivePosition(appearance);
       if (result != null) result.setY(result.getY() + activeLineY);
       return result;
     } else {
       return null;
     }
   }
 }
Пример #3
0
 /* (non-Javadoc)
  * @see org.fenggui.IWidget#getY()
  */
 public int getY() {
   return position.getY();
 }
  private void translate(Point current, Point destination, Point speed) {
    if (current.getX() > destination.getX()) {
      current.setX(current.getX() - speed.getX());
      if (current.getX() < destination.getX()) {
        current.setX(destination.getX());
      }
    } else {
      current.setX(current.getX() + speed.getX());
      if (current.getX() > destination.getX()) {
        current.setX(destination.getX());
      }
    }

    if (current.getY() > destination.getY()) {
      current.setX(current.getY() - speed.getY());
      if (current.getY() < destination.getY()) {
        current.setX(destination.getY());
      }
    } else {
      current.setX(current.getY() + speed.getY());
      if (current.getY() > destination.getY()) {
        current.setY(destination.getY());
      }
    }
  }