예제 #1
0
  /**
   * Draws this using a cardinal direction.
   *
   * @param g Graphics to draw in.
   * @param size Size of the Window to draw in.
   * @param dir One of the following directions:<br>
   *     NORTH, NORTH_EAST, EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST.
   */
  protected void drawText(Graphics g, Dimension size, int dir) {
    Point pos = new Point();
    int xMax = size.width - m_bounds.width - 1, yMax = size.height - m_bounds.height - 1;

    if ((dir & 8) != 0) pos.x = xMax;
    else if ((dir & 4) != 0) pos.x = xMax >> 1;
    if ((dir & 2) != 0) pos.y = yMax;
    else if ((dir & 1) != 0) pos.y = yMax >> 1;

    drawText(g, size, pos);
  }
예제 #2
0
 /**
  * Draws this using a previously evaluated position.
  *
  * @param g Graphics to draw in.
  * @param size Size of the Window to draw in.
  */
 protected void drawText(Graphics g, Dimension size) {
   drawText(g, size, new Point(m_bounds.x, m_bounds.y));
 }