< prev index next >

src/java.desktop/share/classes/javax/swing/JComponent.java

Print this page




 496      */
 497     public boolean getInheritsPopupMenu() {
 498         return getFlag(INHERITS_POPUP_MENU);
 499     }
 500 
 501     /**
 502      * Sets the <code>JPopupMenu</code> for this <code>JComponent</code>.
 503      * The UI is responsible for registering bindings and adding the necessary
 504      * listeners such that the <code>JPopupMenu</code> will be shown at
 505      * the appropriate time. When the <code>JPopupMenu</code> is shown
 506      * depends upon the look and feel: some may show it on a mouse event,
 507      * some may enable a key binding.
 508      * <p>
 509      * If <code>popup</code> is null, and <code>getInheritsPopupMenu</code>
 510      * returns true, then <code>getComponentPopupMenu</code> will be delegated
 511      * to the parent. This provides for a way to make all child components
 512      * inherit the popupmenu of the parent.
 513      * <p>
 514      * This is a bound property.
 515      *
 516      * @param popup - the popup that will be assigned to this component
 517      *                may be null
 518      * @see #getComponentPopupMenu
 519      * @since 1.5
 520      */
 521     @BeanProperty(preferred = true, description
 522             = "Popup to show")
 523     public void setComponentPopupMenu(JPopupMenu popup) {
 524         if(popup != null) {
 525             enableEvents(AWTEvent.MOUSE_EVENT_MASK);
 526         }
 527         JPopupMenu oldPopup = this.popupMenu;
 528         this.popupMenu = popup;
 529         firePropertyChange("componentPopupMenu", oldPopup, popup);
 530     }
 531 
 532     /**
 533      * Returns <code>JPopupMenu</code> that assigned for this component.
 534      * If this component does not have a <code>JPopupMenu</code> assigned
 535      * to it and <code>getInheritsPopupMenu</code> is true, this
 536      * will return <code>getParent().getComponentPopupMenu()</code> (assuming




 496      */
 497     public boolean getInheritsPopupMenu() {
 498         return getFlag(INHERITS_POPUP_MENU);
 499     }
 500 
 501     /**
 502      * Sets the <code>JPopupMenu</code> for this <code>JComponent</code>.
 503      * The UI is responsible for registering bindings and adding the necessary
 504      * listeners such that the <code>JPopupMenu</code> will be shown at
 505      * the appropriate time. When the <code>JPopupMenu</code> is shown
 506      * depends upon the look and feel: some may show it on a mouse event,
 507      * some may enable a key binding.
 508      * <p>
 509      * If <code>popup</code> is null, and <code>getInheritsPopupMenu</code>
 510      * returns true, then <code>getComponentPopupMenu</code> will be delegated
 511      * to the parent. This provides for a way to make all child components
 512      * inherit the popupmenu of the parent.
 513      * <p>
 514      * This is a bound property.
 515      *
 516      * @param popup  the popup that will be assigned to this component
 517      *               may be null
 518      * @see #getComponentPopupMenu
 519      * @since 1.5
 520      */
 521     @BeanProperty(preferred = true, description
 522             = "Popup to show")
 523     public void setComponentPopupMenu(JPopupMenu popup) {
 524         if(popup != null) {
 525             enableEvents(AWTEvent.MOUSE_EVENT_MASK);
 526         }
 527         JPopupMenu oldPopup = this.popupMenu;
 528         this.popupMenu = popup;
 529         firePropertyChange("componentPopupMenu", oldPopup, popup);
 530     }
 531 
 532     /**
 533      * Returns <code>JPopupMenu</code> that assigned for this component.
 534      * If this component does not have a <code>JPopupMenu</code> assigned
 535      * to it and <code>getInheritsPopupMenu</code> is true, this
 536      * will return <code>getParent().getComponentPopupMenu()</code> (assuming


< prev index next >