jdk/src/share/classes/javax/swing/JComboBox.java
changeset 24982 37fe99dfd9e9
parent 23715 54ae9dd9df73
child 25144 e2bf17cee34b
equal deleted inserted replaced
24981:09fa2afd361a 24982:37fe99dfd9e9
   230         installAncestorListener();
   230         installAncestorListener();
   231         setUIProperty("opaque",true);
   231         setUIProperty("opaque",true);
   232         updateUI();
   232         updateUI();
   233     }
   233     }
   234 
   234 
       
   235     /**
       
   236      * Registers ancestor listener so that it will receive
       
   237      * {@code AncestorEvents} when it or any of its ancestors
       
   238      * move or are made visible or invisible.
       
   239      * Events are also sent when the component or its ancestors are added
       
   240      * or removed from the containment hierarchy.
       
   241      */
   235     protected void installAncestorListener() {
   242     protected void installAncestorListener() {
   236         addAncestorListener(new AncestorListener(){
   243         addAncestorListener(new AncestorListener(){
   237                                 public void ancestorAdded(AncestorEvent event){ hidePopup();}
   244                                 public void ancestorAdded(AncestorEvent event){ hidePopup();}
   238                                 public void ancestorRemoved(AncestorEvent event){ hidePopup();}
   245                                 public void ancestorRemoved(AncestorEvent event){ hidePopup();}
   239                                 public void ancestorMoved(AncestorEvent event){
   246                                 public void ancestorMoved(AncestorEvent event){
   810         setPopupVisible(false);
   817         setPopupVisible(false);
   811     }
   818     }
   812 
   819 
   813     /**
   820     /**
   814      * Sets the visibility of the popup.
   821      * Sets the visibility of the popup.
       
   822      *
       
   823      * @param v if {@code true} shows the popup, otherwise, hides the popup.
   815      */
   824      */
   816     public void setPopupVisible(boolean v) {
   825     public void setPopupVisible(boolean v) {
   817         getUI().setPopupVisible(this, v);
   826         getUI().setPopupVisible(this, v);
   818     }
   827     }
   819 
   828 
  1142      * <b>Warning:</b> If you subclass this do not create an anonymous
  1151      * <b>Warning:</b> If you subclass this do not create an anonymous
  1143      * inner class.  If you do the lifetime of the combobox will be tied to
  1152      * inner class.  If you do the lifetime of the combobox will be tied to
  1144      * that of the <code>Action</code>.
  1153      * that of the <code>Action</code>.
  1145      *
  1154      *
  1146      * @param a the combobox's action
  1155      * @param a the combobox's action
       
  1156      * @return the {@code PropertyChangeListener}
  1147      * @since 1.3
  1157      * @since 1.3
  1148      * @see Action
  1158      * @see Action
  1149      * @see #setAction
  1159      * @see #setAction
  1150      */
  1160      */
  1151     protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
  1161     protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
  1355      * character and returns true, if there is an item corresponding
  1365      * character and returns true, if there is an item corresponding
  1356      * to that character.  Otherwise, returns false.
  1366      * to that character.  Otherwise, returns false.
  1357      *
  1367      *
  1358      * @param keyChar a char, typically this is a keyboard key
  1368      * @param keyChar a char, typically this is a keyboard key
  1359      *                  typed by the user
  1369      *                  typed by the user
       
  1370      * @return {@code true} if there is an item corresponding to that character.
       
  1371      *         Otherwise, returns {@code false}.
  1360      */
  1372      */
  1361     public boolean selectWithKeyChar(char keyChar) {
  1373     public boolean selectWithKeyChar(char keyChar) {
  1362         int index;
  1374         int index;
  1363 
  1375 
  1364         if ( keySelectionManager == null )
  1376         if ( keySelectionManager == null )
  1441     /**
  1453     /**
  1442      * Sets the object that translates a keyboard character into a list
  1454      * Sets the object that translates a keyboard character into a list
  1443      * selection. Typically, the first selection with a matching first
  1455      * selection. Typically, the first selection with a matching first
  1444      * character becomes the selected item.
  1456      * character becomes the selected item.
  1445      *
  1457      *
       
  1458      * @param aManager a key selection manager
  1446      * @beaninfo
  1459      * @beaninfo
  1447      *       expert: true
  1460      *       expert: true
  1448      *  description: The objects that changes the selection when a key is pressed.
  1461      *  description: The objects that changes the selection when a key is pressed.
  1449      */
  1462      */
  1450     public void setKeySelectionManager(KeySelectionManager aManager) {
  1463     public void setKeySelectionManager(KeySelectionManager aManager) {