示例#1
0
  /** @param x, y, width, heith - dimensions of the window with insets */
  private void reshape(int x, int y, int width, int height, int operation, boolean userReshape) {
    Rectangle newRec;
    boolean setClient = false;
    WindowDimensions dims = new WindowDimensions(dimensions);
    switch (operation & (~NO_EMBEDDED_CHECK)) {
      case SET_LOCATION:
        // Set location always sets bounds location. However, until the window is mapped we
        // should use client coordinates
        dims.setLocation(x, y);
        break;
      case SET_SIZE:
        // Set size sets bounds size. However, until the window is mapped we
        // should use client coordinates
        dims.setSize(width, height);
        break;
      case SET_CLIENT_SIZE:
        {
          // Sets client rect size. Width and height contain insets.
          Insets in = currentInsets;
          width -= in.left + in.right;
          height -= in.top + in.bottom;
          dims.setClientSize(width, height);
          break;
        }
      case SET_BOUNDS:
      default:
        dims.setLocation(x, y);
        dims.setSize(width, height);
        break;
    }
    if (insLog.isLoggable(Level.FINE)) {
      insLog.log(
          Level.FINE,
          "For the operation {0} new dimensions are {1}",
          new Object[] {operationToString(operation), String.valueOf(dims)});
    }

    reshape(dims, operation, userReshape);
  }