コード例 #1
0
  public void showMenu() {
    if (LOCATION == BELOW) {
      setPopupLocation(main.getX() - main.getWidth(), main.getY() + getHeight());
    } else if (LOCATION == ABOVE) {
      setPopupLocation(main.getX() - main.getWidth(), main.getY() - menu.getHeight());
    }

    if (getPopperButtonLocation() == RIGHT) {
      if (getPopperButtonLocation() == RIGHT) {
        tempPopArrowDir = getPopperArrowDirection();
      }

      setPopperArrowDirection(DOWN);
    }

    menu.show(popper, getPopupX(), getPopupY());
  }
コード例 #2
0
  public void layoutComponents() {
    setLayout(new BorderLayout());
    add(main, BorderLayout.CENTER);

    if (popperIsVisible) {
      if (getPopperButtonLocation() == RIGHT) {
        popper.setPreferredSize(new Dimension(14, main.getHeight()));
        add(popper, BorderLayout.EAST);
      } else if (getPopperButtonLocation() == BOTTOM) {
        popper.setPreferredSize(new Dimension(main.getWidth(), 14));
        add(popper, BorderLayout.SOUTH);

        setPopperArrowDirection(DOWN);
        setPopupLocation(popper.getX(), popper.getY() + popper.getHeight() + 5);
      }
    }

    Utilities.updateView(this);
  }