Index: javax/swing/plaf/basic/BasicListUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v retrieving revision 1.40 diff -u -r1.40 BasicListUI.java --- javax/swing/plaf/basic/BasicListUI.java 15 Nov 2005 20:32:46 -0000 1.40 +++ javax/swing/plaf/basic/BasicListUI.java 16 Nov 2005 15:31:22 -0000 @@ -703,12 +703,17 @@ */ protected int getRowHeight(int row) { - if (row < 0 || row >= cellHeights.length) - return -1; - else if (cellHeight != -1) - return cellHeight; + int height; + if (cellHeights == null) + height = cellHeight; else - return cellHeights[row]; + { + if (row < 0 || row >= cellHeights.length) + height = -1; + else + height = cellHeights[row]; + } + return height; } /** @@ -803,9 +808,7 @@ // If a fixed cell height is set, then we can work more efficient. if (cellHeight > 0) - { - index = Math.max(y0 / cellHeight, index); - } + index = Math.min(y0 / cellHeight, index); // If we have no fixed cell height, we must add up each cell height up // to y0. else Index: javax/swing/plaf/basic/BasicMenuItemUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java,v retrieving revision 1.38 diff -u -r1.38 BasicMenuItemUI.java --- javax/swing/plaf/basic/BasicMenuItemUI.java 14 Nov 2005 20:23:56 -0000 1.38 +++ javax/swing/plaf/basic/BasicMenuItemUI.java 16 Nov 2005 15:31:22 -0000 @@ -475,7 +475,6 @@ menuItem.setHorizontalTextPosition(SwingConstants.TRAILING); menuItem.setHorizontalAlignment(SwingConstants.LEADING); - menuItem.setOpaque(true); } /** @@ -553,11 +552,20 @@ */ protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { - Dimension size = getPreferredSize(menuItem); - Color foreground = g.getColor(); - g.setColor(bgColor); - g.drawRect(0, 0, size.width, size.height); - g.setColor(foreground); + // Menu item is considered to be highlighted when it is selected. + // But we don't want to paint the background of JCheckBoxMenuItems + ButtonModel mod = menuItem.getModel(); + if ((menuItem.isSelected() && checkIcon == null) || (mod != null && + mod.isArmed()) + && (menuItem.getParent() instanceof MenuElement)) + { + if (menuItem.isContentAreaFilled()) + { + g.setColor(selectionBackground); + g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight()); + } + } + } /** @@ -600,7 +608,8 @@ FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); - paintBackground(g, m, m.getBackground()); + if (m.isOpaque()) + paintBackground(g, m, m.getBackground()); /* * MenuItems insets are equal to menuItems margin, space between text and @@ -611,28 +620,6 @@ br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; - - // Menu item is considered to be highlighted when it is selected. - // But we don't want to paint the background of JCheckBoxMenuItems - ButtonModel mod = m.getModel(); - if ((m.isSelected() && checkIcon == null) || (mod != null && - mod.isArmed()) - && (m.getParent() instanceof MenuElement)) - { - if (m.isContentAreaFilled()) - { - g.setColor(selectionBackground); - g.fillRect(br.x, br.y, br.width, br.height); - } - } - else - { - if (m.isContentAreaFilled()) - { - g.setColor(m.getBackground()); - g.fillRect(br.x, br.y, br.width, br.height); - } - } // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) Index: javax/swing/plaf/basic/BasicMenuUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuUI.java,v retrieving revision 1.20 diff -u -r1.20 BasicMenuUI.java --- javax/swing/plaf/basic/BasicMenuUI.java 25 Oct 2005 13:49:47 -0000 1.20 +++ javax/swing/plaf/basic/BasicMenuUI.java 16 Nov 2005 15:31:23 -0000 @@ -211,7 +211,6 @@ selectionForeground = UIManager.getColor("Menu.selectionForeground"); arrowIcon = UIManager.getIcon("Menu.arrowIcon"); oldBorderPainted = UIManager.getBoolean("Menu.borderPainted"); - menuItem.setOpaque(true); } /**