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

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

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

revision 1.8 by trebligd, Thu Sep 29 20:19:20 2005 UTC revision 1.9 by rabbit78, Mon Oct 17 13:35:59 2005 UTC
# Line 718  public class BasicComboPopup extends JPo Line 718  public class BasicComboPopup extends JPo
718    protected void updateListBoxSelectionForEvent(MouseEvent anEvent,    protected void updateListBoxSelectionForEvent(MouseEvent anEvent,
719                                                  boolean shouldScroll)                                                  boolean shouldScroll)
720    {    {
721      // FIXME: Need to implement      // TODO: We need to handle the shouldScroll parameter somehow.
722        int index = list.locationToIndex(anEvent.getPoint());
723        // Check for valid index.
724        if (index >= 0)
725          list.setSelectedIndex(index);
726    }    }
727    
728    /**    /**
# Line 736  public class BasicComboPopup extends JPo Line 740  public class BasicComboPopup extends JPo
740       */       */
741      protected InvocationMouseHandler()      protected InvocationMouseHandler()
742      {      {
743          // Nothing to do here.
744      }      }
745    
746      /**      /**
# Line 748  public class BasicComboPopup extends JPo Line 753  public class BasicComboPopup extends JPo
753      public void mousePressed(MouseEvent e)      public void mousePressed(MouseEvent e)
754      {      {
755        if (comboBox.isEnabled())        if (comboBox.isEnabled())
756          togglePopup();          togglePopup();
757      }      }
758    
759      /**      /**
# Line 772  public class BasicComboPopup extends JPo Line 777  public class BasicComboPopup extends JPo
777        // then change selection and close popup        // then change selection and close popup
778        if (! (releasedComponent instanceof JComboBox))        if (! (releasedComponent instanceof JComboBox))
779          {          {
780            // List model contains the item over which mouse is released,            // List model contains the item over which mouse is released,
781            // since it is updated every time the mouse is moved over a different            // since it is updated every time the mouse is moved over a different
782            // item in the list. Now that the mouse is released we need to            // item in the list. Now that the mouse is released we need to
783            // update model of the combo box as well.                  // update model of the combo box as well.      
784            comboBox.setSelectedIndex(list.getSelectedIndex());            comboBox.setSelectedIndex(list.getSelectedIndex());
785    
786            if (isAutoScrolling)            if (isAutoScrolling)
787              stopAutoScrolling();              stopAutoScrolling();
788            hide();            hide();
789          }          }
790      }      }
791    }    }
# Line 796  public class BasicComboPopup extends JPo Line 801  public class BasicComboPopup extends JPo
801       */       */
802      protected InvocationMouseMotionHandler()      protected InvocationMouseMotionHandler()
803      {      {
804          // Nothing to do here.
805      }      }
806    
807      /**      /**
# Line 872  public class BasicComboPopup extends JPo Line 878  public class BasicComboPopup extends JPo
878       */       */
879      protected ItemHandler()      protected ItemHandler()
880      {      {
881          // Nothing to do here.
882      }      }
883    
884      /**      /**
# Line 881  public class BasicComboPopup extends JPo Line 888  public class BasicComboPopup extends JPo
888       */       */
889      public void itemStateChanged(ItemEvent e)      public void itemStateChanged(ItemEvent e)
890      {      {
891          // TODO: What should be done here?
892      }      }
893    }    }
894    
# Line 894  public class BasicComboPopup extends JPo Line 902  public class BasicComboPopup extends JPo
902    {    {
903      protected ListMouseHandler()      protected ListMouseHandler()
904      {      {
905          // Nothing to do here.
906      }      }
907    
908      public void mousePressed(MouseEvent e)      public void mousePressed(MouseEvent e)
909      {      {
910          // TODO: What should be do here?
911      }      }
912    
913      public void mouseReleased(MouseEvent anEvent)      public void mouseReleased(MouseEvent anEvent)
914      {      {
915        int index = list.locationToIndex(anEvent.getPoint());        updateListBoxSelectionForEvent(anEvent, false);
       comboBox.setSelectedIndex(index);  
916        hide();        hide();
917      }      }
918    }    }
# Line 917  public class BasicComboPopup extends JPo Line 926  public class BasicComboPopup extends JPo
926    {    {
927      protected ListMouseMotionHandler()      protected ListMouseMotionHandler()
928      {      {
929          // Nothing to do here.
930      }      }
931    
932      public void mouseMoved(MouseEvent anEvent)      public void mouseMoved(MouseEvent anEvent)
933      {      {
934        // Highlight list cells over which the mouse is located.        updateListBoxSelectionForEvent(anEvent, false);
       // This changes list model, but has no effect on combo box's data model  
       int index = list.locationToIndex(anEvent.getPoint());  
       list.setSelectedIndex(index);  
       list.repaint();  
935      }      }
936    }    }
937    
# Line 938  public class BasicComboPopup extends JPo Line 944  public class BasicComboPopup extends JPo
944    {    {
945      protected PropertyChangeHandler()      protected PropertyChangeHandler()
946      {      {
947          // Nothing to do here.
948      }      }
949    
950      public void propertyChange(PropertyChangeEvent e)      public void propertyChange(PropertyChangeEvent e)
# Line 1013  public class BasicComboPopup extends JPo Line 1020  public class BasicComboPopup extends JPo
1020    {    {
1021      public ListDataHandler()      public ListDataHandler()
1022      {      {
1023          // Nothing to do here.
1024      }      }
1025    
1026      public void contentsChanged(ListDataEvent e)      public void contentsChanged(ListDataEvent e)
1027      {      {
1028          // Nothing to do here.
1029      }      }
1030    
1031      public void intervalAdded(ListDataEvent e)      public void intervalAdded(ListDataEvent e)
1032      {      {
1033          // Nothing to do here.
1034      }      }
1035    
1036      public void intervalRemoved(ListDataEvent e)      public void intervalRemoved(ListDataEvent e)
1037      {      {
1038          // Nothing to do here.
1039      }      }
1040    }    }
1041    
# Line 1036  public class BasicComboPopup extends JPo Line 1047  public class BasicComboPopup extends JPo
1047    {    {
1048      protected ListSelectionHandler()      protected ListSelectionHandler()
1049      {      {
1050          // Nothing to do here.
1051      }      }
1052    
1053      public void valueChanged(ListSelectionEvent e)      public void valueChanged(ListSelectionEvent e)
1054      {      {
1055          // Nothing to do here.
1056      }      }
1057    }    }
1058    
# Line 1050  public class BasicComboPopup extends JPo Line 1063  public class BasicComboPopup extends JPo
1063    {    {
1064      public InvocationKeyHandler()      public InvocationKeyHandler()
1065      {      {
1066          // Nothing to do here.
1067      }      }
1068    
1069      public void keyReleased(KeyEvent e)      public void keyReleased(KeyEvent e)
1070      {      {
1071          // Nothing to do here.
1072      }      }
1073    }    }
1074  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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