Example usage for javax.swing JPopupMenu setSize

List of usage examples for javax.swing JPopupMenu setSize

Introduction

In this page you can find the example usage for javax.swing JPopupMenu setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

Resizes this component so that it has width width and height height .

Usage

From source file:picocash.components.mode.buttons.ModeButton.java

private void init() {
    setLayout(new MigLayout("fill"));
    add(iconLabel);/*w  ww.  j  a  v a  2s. com*/
    add(nameLabel, "push");
    add(minimizeLabel);

    minimizeLabel.setIcon(PicocashIcons.getSystemIcon("minimize-dark"));

    addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            JPopupMenu popupMenu = new JPopupMenu();
            fillPopupMenu(popupMenu);
            Dimension dimension = getSize();
            popupMenu.setSize(dimension.width, popupMenu.getHeight());
            popupMenu.show((Component) arg0.getSource(), -1, dimension.height + 3);
        }
    });
}