< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java

Print this page




 521         return handler;
 522     }
 523 
 524     /**
 525      * Creates the JList used in the popup to display
 526      * the items in the combo box model. This method is called when the UI class
 527      * is created.
 528      *
 529      * @return a <code>JList</code> used to display the combo box items
 530      */
 531     protected JList<Object> createList() {
 532         return new JList<Object>( comboBox.getModel() ) {
 533             @SuppressWarnings("deprecation")
 534             public void processMouseEvent(MouseEvent e)  {
 535                 if (BasicGraphicsUtils.isMenuShortcutKeyDown(e))  {
 536                     // Fix for 4234053. Filter out the Control Key from the list.
 537                     // ie., don't allow CTRL key deselection.
 538                     Toolkit toolkit = Toolkit.getDefaultToolkit();
 539                     MouseEvent newEvent = new MouseEvent(
 540                                        (Component)e.getSource(), e.getID(), e.getWhen(),
 541                                        e.getModifiers() ^ toolkit.getMenuShortcutKeyMask(),
 542                                        e.getX(), e.getY(),
 543                                        e.getXOnScreen(), e.getYOnScreen(),
 544                                        e.getClickCount(),
 545                                        e.isPopupTrigger(),
 546                                        MouseEvent.NOBUTTON);
 547                     MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
 548                     meAccessor.setCausedByTouchEvent(newEvent,
 549                         meAccessor.isCausedByTouchEvent(e));
 550                     e = newEvent;
 551                 }
 552                 super.processMouseEvent(e);
 553             }
 554         };
 555     }
 556 
 557     /**
 558      * Configures the list which is used to hold the combo box items in the
 559      * popup. This method is called when the UI class
 560      * is created.
 561      *




 521         return handler;
 522     }
 523 
 524     /**
 525      * Creates the JList used in the popup to display
 526      * the items in the combo box model. This method is called when the UI class
 527      * is created.
 528      *
 529      * @return a <code>JList</code> used to display the combo box items
 530      */
 531     protected JList<Object> createList() {
 532         return new JList<Object>( comboBox.getModel() ) {
 533             @SuppressWarnings("deprecation")
 534             public void processMouseEvent(MouseEvent e)  {
 535                 if (BasicGraphicsUtils.isMenuShortcutKeyDown(e))  {
 536                     // Fix for 4234053. Filter out the Control Key from the list.
 537                     // ie., don't allow CTRL key deselection.
 538                     Toolkit toolkit = Toolkit.getDefaultToolkit();
 539                     MouseEvent newEvent = new MouseEvent(
 540                                        (Component)e.getSource(), e.getID(), e.getWhen(),
 541                                        e.getModifiersEx() ^ toolkit.getMenuShortcutKeyMaskEx(),
 542                                        e.getX(), e.getY(),
 543                                        e.getXOnScreen(), e.getYOnScreen(),
 544                                        e.getClickCount(),
 545                                        e.isPopupTrigger(),
 546                                        MouseEvent.NOBUTTON);
 547                     MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
 548                     meAccessor.setCausedByTouchEvent(newEvent,
 549                         meAccessor.isCausedByTouchEvent(e));
 550                     e = newEvent;
 551                 }
 552                 super.processMouseEvent(e);
 553             }
 554         };
 555     }
 556 
 557     /**
 558      * Configures the list which is used to hold the combo box items in the
 559      * popup. This method is called when the UI class
 560      * is created.
 561      *


< prev index next >