Index: javax/swing/ToolTipManager.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/ToolTipManager.java,v retrieving revision 1.19 diff -u -r1.19 ToolTipManager.java --- javax/swing/ToolTipManager.java 21 Sep 2005 21:21:19 -0000 1.19 +++ javax/swing/ToolTipManager.java 22 Sep 2005 15:28:47 -0000 @@ -467,18 +467,12 @@ Container parent = currentComponent.getParent(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); - Rectangle bounds = currentComponent.getBounds(); - p.x += bounds.width - dims.width; - p.y = bounds.height; if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); - + if (isLightWeightPopupEnabled()) { - if (p.x < parent.getBounds().x) - p.x = 0; - JLayeredPane pane = ((JRootPane) SwingUtilities. getAncestorOfClass(JRootPane.class, currentComponent)). getLayeredPane(); @@ -503,17 +497,18 @@ } p = SwingUtilities.convertPoint(currentComponent, p, pane); + p = adjustLocation(p, pane, dims); + pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); } else if (currentComponent.isShowing()) - { - Rectangle b = parent.getBounds(); - if (p.x + dims.width > b.x + b.width) - p.x = b.x - dims.width; - + { SwingUtilities.convertPointToScreen(p, currentComponent); + p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), + dims); + tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); @@ -524,10 +519,30 @@ tooltipWindow.show(); } currentTip.setVisible(true); - currentTip.revalidate(); - currentTip.repaint(); } + /** + * Adjusts the point to a new location on the component, + * using the currentTip's dimensions. + * + * @param p - the point to convert. + * @param c - the component the point is on. + * @param d - the dimensions of the currentTip. + */ + private Point adjustLocation(Point p, Component c, Dimension d) + { + if (p.x + d.width > c.getWidth()) + p.x -= d.width; + if (p.x < 0) + p.x = 0; + if (p.y + d.height < c.getHeight()) + p.y += d.height; + else if (p.y + d.height > c.getHeight()) + p.y -= d.height*2; + + return p; + } + /** * This method hides the ToolTip. * This is package-private to avoid an accessor method. Index: javax/swing/plaf/basic/BasicLookAndFeel.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v retrieving revision 1.56 diff -u -r1.56 BasicLookAndFeel.java --- javax/swing/plaf/basic/BasicLookAndFeel.java 20 Sep 2005 09:51:52 -0000 1.56 +++ javax/swing/plaf/basic/BasicLookAndFeel.java 22 Sep 2005 15:28:47 -0000 @@ -898,22 +898,22 @@ "ctrl SLASH", "selectAll", "ctrl shift KP_DOWN", "selectNextRowExtendSelection", }), - "Table.background", new ColorUIResource(light), - "Table.focusCellBackground", new ColorUIResource(light), - "Table.focusCellForeground", new ColorUIResource(darkShadow), + "Table.background", new ColorUIResource(new ColorUIResource(255, 255, 255)), + "Table.focusCellBackground", new ColorUIResource(new ColorUIResource(255, 255, 255)), + "Table.focusCellForeground", new ColorUIResource(new ColorUIResource(0, 0, 0)), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource( new ColorUIResource(255, 255, 0)), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "Table.foreground", new ColorUIResource(darkShadow), - "Table.gridColor", new ColorUIResource(Color.gray), + "Table.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)), + "Table.gridColor", new ColorUIResource(new ColorUIResource(128, 128, 128)), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), - "Table.selectionBackground", new ColorUIResource(Color.black), - "Table.selectionForeground", new ColorUIResource(Color.white), - "TableHeader.background", new ColorUIResource(light), + "Table.selectionBackground", new ColorUIResource(new ColorUIResource(0, 0, 128)), + "Table.selectionForeground", new ColorUIResource(new ColorUIResource(255, 255, 255)), + "TableHeader.background", new ColorUIResource(new ColorUIResource(192, 192, 192)), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "TableHeader.foreground", new ColorUIResource(darkShadow), + "TableHeader.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)), "TextArea.background", new ColorUIResource(light), "TextArea.border", @@ -1040,7 +1040,7 @@ "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), - "Tree.background", new ColorUIResource(light), + "Tree.background", new ColorUIResource(new Color(255, 255, 255)), "Tree.changeSelectionWithFocus", Boolean.TRUE, // "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")), // "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), @@ -1090,20 +1090,20 @@ "PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_DOWN", "scrollDownChangeLead" }), - "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), + "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Tree.foreground", new ColorUIResource(Color.black), "Tree.hash", new ColorUIResource(new Color(128, 128, 128)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), - "Tree.rowHeight", new Integer(20), // FIXME + "Tree.rowHeight", new Integer(16), "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(Color.black), - "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)), + "Tree.nonSelectionBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.selectionBorderColor", new ColorUIResource(Color.black), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)), - "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)), - "Tree.textForeground", new ColorUIResource(Color.black), + "Tree.textBackground", new ColorUIResource(new Color(192, 192, 192)), + "Tree.textForeground", new ColorUIResource(new Color(0, 0, 0)), "Viewport.background", new ColorUIResource(light), "Viewport.foreground", new ColorUIResource(Color.black), "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) Index: javax/swing/plaf/basic/BasicToolTipUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicToolTipUI.java,v retrieving revision 1.5 diff -u -r1.5 BasicToolTipUI.java --- javax/swing/plaf/basic/BasicToolTipUI.java 8 Jul 2005 15:24:08 -0000 1.5 +++ javax/swing/plaf/basic/BasicToolTipUI.java 22 Sep 2005 15:28:47 -0000 @@ -61,55 +61,6 @@ */ public class BasicToolTipUI extends ToolTipUI { - /** The default Border around the JToolTip. */ - private static Border defaultBorder = new Border() - { - // FIXME: This needs to go into Basic Look and Feel - // defaults. - - /** - * This method returns the border insets. - * - * @param c The Component to find Border insets for. - * - * @return The Border insets. - */ - public Insets getBorderInsets(Component c) - { - return new Insets(4, 4, 4, 4); - } - - /** - * This method returns whether the border is opaque. - * - * @return Whether the border is opaque. - */ - public boolean isBorderOpaque() - { - return false; - } - - /** - * This method paints the border. - * - * @param c The Component to paint this border around. - * @param g The Graphics object to paint with. - * @param x The x coordinate to start painting at. - * @param y The y coordinate to start painting at. - * @param w The width of the Component. - * @param h The height of the Component. - */ - public void paintBorder(Component c, Graphics g, int x, int y, int w, - int h) - { - Color saved = g.getColor(); - g.setColor(Color.BLACK); - - g.drawRect(0, 0, w - 1, h - 1); - - g.setColor(saved); - } - }; /** The shared instance of BasicToolTipUI used for all ToolTips. */ private static BasicToolTipUI shared; @@ -196,7 +147,7 @@ c.setBackground(defaults.getColor("ToolTip.background")); c.setForeground(defaults.getColor("ToolTip.foreground")); c.setFont(defaults.getFont("ToolTip.font")); - c.setBorder(defaultBorder); + c.setBorder(defaults.getBorder("ToolTip.border")); } /** Index: javax/swing/plaf/metal/MetalLookAndFeel.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,v retrieving revision 1.57 diff -u -r1.57 MetalLookAndFeel.java --- javax/swing/plaf/metal/MetalLookAndFeel.java 20 Sep 2005 09:32:30 -0000 1.57 +++ javax/swing/plaf/metal/MetalLookAndFeel.java 22 Sep 2005 15:28:47 -0000 @@ -1045,18 +1045,19 @@ "TabbedPane.tabAreaBackground", getControl(), "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6), "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9), - - "Table.background", getWindowBackground(), - "Table.focusCellBackground", getWindowBackground(), - "Table.focusCellForeground", getControlTextColor(), - "Table.foreground", getControlTextColor(), - "Table.focusCellHighlightBorder", getControlShadow(), - "Table.focusCellBackground", getWindowBackground(), - "Table.gridColor", getControlDarkShadow(), + + "Table.background", new ColorUIResource(204, 204, 204), + "Table.focusCellBackground", new ColorUIResource(255, 255, 255), + "Table.focusCellForeground", new ColorUIResource(0, 0, 0), + "Table.foreground", new ColorUIResource(0, 0, 0), + "Table.focusCellHighlightBorder", new ColorUIResource(153, 153, 204), + "Table.gridColor", new ColorUIResource(153, 153, 153), + "Table.selectionBackground", new ColorUIResource(204, 204, 255), + "Table.selectionForeground", new ColorUIResource(0, 0, 0), "TableHeader.background", getControl(), "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(), - "TableHeader.foreground", getControlTextColor(), + "TableHeader.foreground", new ColorUIResource(0, 0, 0), "TextArea.background", getWindowBackground(), "TextArea.caretForeground", getUserTextColor(),