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

jadex.commons.gui.PopupBuilder Maven / Gradle / Ivy

There is a newer version: 3.0.117
Show newest version
package jadex.commons.gui;

import java.util.ArrayList;
import java.util.List;

import javax.swing.Action;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

import jadex.commons.SUtil;

/**
 *  The popup builder. Constructs a (non-nested) popup menu from actions.
 */
public class PopupBuilder
{
	/** The menu-items and actions. */
	protected List rawmenu;

	/**
	 *  Create the popup builder.
	 *  @param rawmenu The raw menu.
	 */
	public PopupBuilder()
	{
		this.rawmenu = new ArrayList();
	}
	
	/**
	 *  Create the popup builder.
	 *  @param rawmenu The raw menu.
	 */
	public PopupBuilder(List rawmenu)
	{
		this.rawmenu = rawmenu;
	}

	/**
	 *  Create the popup builder.
	 *  @param rawmenu The raw menu.
	 */
	public PopupBuilder(Object[] rawmenu)
	{
		this.rawmenu = SUtil.arrayToList(rawmenu);
	}

	/**
	 *  Build the popup menu.
	 *  @return The popup menu.
	 */
	public JPopupMenu buildPopupMenu()
	{
		JPopupMenu pop = new JPopupMenu();

		for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy