/[classpath]/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicComboBoxUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by trebligd, Sun Sep 18 13:39:54 2005 UTC revision 1.15 by trebligd, Sun Sep 18 14:15:04 2005 UTC
# Line 289  public class BasicComboBoxUI extends Com Line 289  public class BasicComboBoxUI extends Com
289      comboBox.addKeyListener(keyListener);      comboBox.addKeyListener(keyListener);
290    
291      mouseListener = createMouseListener();      mouseListener = createMouseListener();
292      comboBox.addMouseListener(mouseListener);      arrowButton.addMouseListener(mouseListener);
293    
294      // install listeners that listen to combo box model      // install listeners that listen to combo box model
295      listDataListener = createListDataListener();      listDataListener = createListDataListener();
296      comboBox.getModel().addListDataListener(listDataListener);      comboBox.getModel().addListDataListener(listDataListener);
   
     configureArrowButton();  
297    }    }
298    
299    /**    /**
# Line 339  public class BasicComboBoxUI extends Com Line 337  public class BasicComboBoxUI extends Com
337      comboBox.removeKeyListener(keyListener);      comboBox.removeKeyListener(keyListener);
338      keyListener = null;      keyListener = null;
339    
340      comboBox.removeMouseListener(mouseListener);      arrowButton.removeMouseListener(mouseListener);
341      mouseListener = null;      mouseListener = null;
342    
343      comboBox.getModel().removeListDataListener(listDataListener);      comboBox.getModel().removeListDataListener(listDataListener);
344      listDataListener = null;      listDataListener = null;
   
     unconfigureArrowButton();  
345    }    }
346    
347    /**    /**
# Line 555  public class BasicComboBoxUI extends Com Line 551  public class BasicComboBoxUI extends Com
551     */     */
552    public void configureArrowButton()    public void configureArrowButton()
553    {    {
554      arrowButton.addMouseListener(mouseListener);      arrowButton.setEnabled(comboBox.isEnabled());
555        arrowButton.setFont(comboBox.getFont());
556    }    }
557    
558    /**    /**
# Line 565  public class BasicComboBoxUI extends Com Line 562  public class BasicComboBoxUI extends Com
562     */     */
563    public void unconfigureArrowButton()    public void unconfigureArrowButton()
564    {    {
     arrowButton.removeMouseListener(mouseListener);  
565    }    }
566    
567    /**    /**
# Line 1270  public class BasicComboBoxUI extends Com Line 1266  public class BasicComboBoxUI extends Com
1266      public void mousePressed(MouseEvent e)      public void mousePressed(MouseEvent e)
1267      {      {
1268        if (comboBox.isEnabled())        if (comboBox.isEnabled())
1269          {          toggleOpenClose();
           if (e.getSource() instanceof JComboBox)  
             {  
               arrowButton.getModel().setPressed(true);  
               arrowButton.getModel().setArmed(true);  
             }  
   
           comboBox.repaint();  
   
           if (e.getSource() instanceof BasicArrowButton)  
             toggleOpenClose();  
         }  
     }  
   
     /**  
      * This method is invoked when mouse is released over the combo box. It  
      * repaints the combo box accordinglly  
      *  
      * @param e the MouseEvent  
      */  
     public void mouseReleased(MouseEvent e)  
     {  
       if (comboBox.isEnabled())  
         {  
           if (e.getSource() instanceof JComboBox)  
             {  
               arrowButton.getModel().setPressed(false);  
               arrowButton.getModel().setArmed(false);  
             }  
   
           comboBox.repaint();  
         }  
1270      }      }
1271    }    }
1272  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26