jdk/src/share/classes/javax/swing/JComboBox.java
changeset 25144 e2bf17cee34b
parent 25110 e1f2746b6439
parent 24982 37fe99dfd9e9
child 25201 4adc75e0c4e5
equal deleted inserted replaced
25143:aade36e70da0 25144:e2bf17cee34b
   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) {
  1357      * character and returns true, if there is an item corresponding
  1367      * character and returns true, if there is an item corresponding
  1358      * to that character.  Otherwise, returns false.
  1368      * to that character.  Otherwise, returns false.
  1359      *
  1369      *
  1360      * @param keyChar a char, typically this is a keyboard key
  1370      * @param keyChar a char, typically this is a keyboard key
  1361      *                  typed by the user
  1371      *                  typed by the user
       
  1372      * @return {@code true} if there is an item corresponding to that character.
       
  1373      *         Otherwise, returns {@code false}.
  1362      */
  1374      */
  1363     public boolean selectWithKeyChar(char keyChar) {
  1375     public boolean selectWithKeyChar(char keyChar) {
  1364         int index;
  1376         int index;
  1365 
  1377 
  1366         if ( keySelectionManager == null )
  1378         if ( keySelectionManager == null )
  1443     /**
  1455     /**
  1444      * Sets the object that translates a keyboard character into a list
  1456      * Sets the object that translates a keyboard character into a list
  1445      * selection. Typically, the first selection with a matching first
  1457      * selection. Typically, the first selection with a matching first
  1446      * character becomes the selected item.
  1458      * character becomes the selected item.
  1447      *
  1459      *
       
  1460      * @param aManager a key selection manager
  1448      * @beaninfo
  1461      * @beaninfo
  1449      *       expert: true
  1462      *       expert: true
  1450      *  description: The objects that changes the selection when a key is pressed.
  1463      *  description: The objects that changes the selection when a key is pressed.
  1451      */
  1464      */
  1452     public void setKeySelectionManager(KeySelectionManager aManager) {
  1465     public void setKeySelectionManager(KeySelectionManager aManager) {