Search in sources :

Example 11 with CMenuItem

use of org.compiere.swing.CMenuItem in project adempiere by adempiere.

the class AProcess method createProcessMenuItem.

private CMenuItem createProcessMenuItem(final I_AD_Process process) {
    final CMenuItem mi = new CMenuItem(model.getDisplayName(process));
    mi.setToolTipText(model.getDescription(process));
    mi.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            startProcess(process);
        }
    });
    return mi;
}
Also used : CMenuItem(org.compiere.swing.CMenuItem) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 12 with CMenuItem

use of org.compiere.swing.CMenuItem in project adempiere by adempiere.

the class AppsAction method getMenuItem.

//	getButton
/**
	 *	Return MenuItem
	 *  @return MenuItem
	 */
public JMenuItem getMenuItem() {
    if (m_menu == null) {
        if (m_toggle) {
            m_menu = new CCheckBoxMenuItem(this);
            m_menu.setSelectedIcon(m_smallPressed);
        } else
            m_menu = new CMenuItem(this);
        m_menu.setAccelerator(m_accelerator);
        m_menu.setActionCommand(m_action);
    }
    return m_menu;
}
Also used : CCheckBoxMenuItem(org.compiere.swing.CCheckBoxMenuItem) CMenuItem(org.compiere.swing.CMenuItem)

Example 13 with CMenuItem

use of org.compiere.swing.CMenuItem in project adempiere by adempiere.

the class AEnv method addMenuItem.

//	getMenu
/**
	 *  Create Menu Item.
	 *  @param actionName   action command
	 *  @param iconName optional name of the icon, defaults to action if null
	 *  @param ks       optional key stroke
	 *  @param menu     menu to add menu item to
	 *  @param al       action listener to register
	 *  @return MenuItem
	 */
public static JMenuItem addMenuItem(String actionName, String iconName, KeyStroke ks, JMenu menu, ActionListener al) {
    if (iconName == null)
        iconName = actionName;
    String text = Msg.getMsg(Env.getCtx(), actionName);
    ImageIcon icon = Env.getImageIcon2(iconName + "16");
    CMenuItem mi = new CMenuItem(text, icon);
    mi.setActionCommand(actionName);
    if (ks != null)
        mi.setAccelerator(ks);
    if (menu != null)
        menu.add(mi);
    if (al != null)
        mi.addActionListener(al);
    return mi;
}
Also used : ImageIcon(javax.swing.ImageIcon) CMenuItem(org.compiere.swing.CMenuItem)

Aggregations

CMenuItem (org.compiere.swing.CMenuItem)13 Dimension (java.awt.Dimension)3 KeyNamePair (org.compiere.util.KeyNamePair)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 ImageIcon (javax.swing.ImageIcon)2 JPopupMenu (javax.swing.JPopupMenu)2 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)2 MAttribute (org.compiere.model.MAttribute)2 MAttributeSet (org.compiere.model.MAttributeSet)2 MAttributeSetInstance (org.compiere.model.MAttributeSetInstance)2 CComboBox (org.compiere.swing.CComboBox)2 CLabel (org.compiere.swing.CLabel)2 Point (java.awt.Point)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 Icon (javax.swing.Icon)1 I_AD_Process (org.compiere.model.I_AD_Process)1 MQuery (org.compiere.model.MQuery)1 CCheckBoxMenuItem (org.compiere.swing.CCheckBoxMenuItem)1