コード例 #1
0
  protected void createButtons() {
    minimizeButton = new MinimizeButton();
    minimizeButton.addActionListener(iconifyAction);

    maximizeButton = new MaximizeButton();
    maximizeButton.addActionListener(maximizeAction);
  }
コード例 #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);
  }