Exemplo n.º 1
0
 /**
  * Factory method which creates the <code>JMenuItem</code> for <code>Actions</code> added to the
  * <code>JPopupMenu</code>.
  *
  * @param a the <code>Action</code> for the menu item to be added
  * @return the new menu item
  * @see Action
  * @since 1.3
  */
 protected JMenuItem createActionComponent(Action a) {
   JMenuItem mi =
       new JMenuItem() {
         protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
           PropertyChangeListener pcl = createActionChangeListener(this);
           if (pcl == null) {
             pcl = super.createActionPropertyChangeListener(a);
           }
           return pcl;
         }
       };
   mi.setHorizontalTextPosition(JButton.TRAILING);
   mi.setVerticalTextPosition(JButton.CENTER);
   return mi;
 }