All Downloads are FREE. Search and download functionalities are using the official Maven repository.

convex.gui.components.DropdownMenu Maven / Gradle / Ivy

There is a newer version: 0.7.15
Show newest version
package convex.gui.components;

import javax.swing.JButton;
import javax.swing.JPopupMenu;

import convex.gui.utils.Toolkit;

/**
 * A dropdown menu that can be used wherever an embedded menu is needed.
 */
@SuppressWarnings("serial")
public class DropdownMenu extends JButton {

	private JPopupMenu popupMenu;

	public DropdownMenu(JPopupMenu popupMenu) {
		super();
		this.popupMenu = popupMenu;
		this.setIcon(Toolkit.COG);
		this.addActionListener(e -> {
			popupMenu.show(this, 0, this.getHeight());
		});
	}

	public JPopupMenu getMenu() {
		return popupMenu;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy