コード例 #1
0
  protected void addSubComponents() {
    title = new Title(frame.getTitle());
    title.setFont(getFont());

    add(systemButton);
    add(title);
    add(minimizeButton);
    add(maximizeButton);
  }
コード例 #2
0
  public void layoutContainer(Container c) {
    int w = getWidth();
    systemButton.setBounds(0, 0, BUTTON_SIZE, BUTTON_SIZE);
    int x = w - BUTTON_SIZE;

    if (frame.isMaximizable()) {
      maximizeButton.setBounds(x, 0, BUTTON_SIZE, BUTTON_SIZE);
      x -= BUTTON_SIZE;
    } else if (maximizeButton.getParent() != null) {
      maximizeButton.getParent().remove(maximizeButton);
    }

    if (frame.isIconifiable()) {
      minimizeButton.setBounds(x, 0, BUTTON_SIZE, BUTTON_SIZE);
      x -= BUTTON_SIZE;
    } else if (minimizeButton.getParent() != null) {
      minimizeButton.getParent().remove(minimizeButton);
    }

    title.setBounds(BUTTON_SIZE, 0, x, BUTTON_SIZE);
  }