Hi, this fixes the size of the combobox popup and sets the selected item in the combobox before closing the popup.
2005-10-17 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JPopupMenu.java (setVisible): Set size according to the size property instead of the preferredSize property. * javax/swing/plaf/basic/BasicComboPopup.java (ListMouseHandler.mouseReleased): Set comboBox selected index before closing the popup. /Roman
Index: javax/swing/JPopupMenu.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JPopupMenu.java,v retrieving revision 1.27 diff -u -r1.27 JPopupMenu.java --- javax/swing/JPopupMenu.java 30 Sep 2005 19:13:23 -0000 1.27 +++ javax/swing/JPopupMenu.java 17 Oct 2005 15:22:19 -0000 @@ -564,7 +564,7 @@ Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; - Dimension size = this.getPreferredSize(); + Dimension size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; Index: javax/swing/plaf/basic/BasicComboPopup.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboPopup.java,v retrieving revision 1.9 diff -u -r1.9 BasicComboPopup.java --- javax/swing/plaf/basic/BasicComboPopup.java 17 Oct 2005 13:35:59 -0000 1.9 +++ javax/swing/plaf/basic/BasicComboPopup.java 17 Oct 2005 15:22:19 -0000 @@ -912,7 +912,10 @@ public void mouseReleased(MouseEvent anEvent) { - updateListBoxSelectionForEvent(anEvent, false); + int index = list.locationToIndex(anEvent.getPoint()); + // Check for valid index. + if (index >= 0) + comboBox.setSelectedIndex(index); hide(); } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches