-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: ssT124754 Date: 03/14/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
I've noticed that the ToolTips for my components often display the raw HTML
code, instead of the formatted version of the same string. It seems to
primarily occur when one button has focus, and another has the mouse hanging
over it. Technically, it appears that the raw code is being displayed in a
purple box _over_ the correct ToolTip (e.g. two tips displayed
simultaneously). The raw code always belongs to the most recently viewed
ToolTip, not the current one hidden below.
Here are some image URLs to illustrate:
http://www.integretechpub.com/javabugs/images/ToolTipRaw1.gif
http://www.integretechpub.com/javabugs/images/ToolTipRaw2.gif
And here is some code, streamlined to demonstrate this flaw. Also included
is an HTML page source that, when used together, best illustrate this bug. I
believe the (constrictive) dimensions of an applet play a small part in this
bug, but I cannot prove that.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class RawToolTipDisplay extends JApplet
{
protected JButton button1 = null;
protected JButton button2 = null;
protected JButton button3 = null;
protected JButton button4 = null;
protected JButton button5 = null;
protected JButton button6 = null;
protected String text1 = "<HTML>Click here to open a new browser
window<BR>containing instructions on the use of this applet.</HTML>";
protected String text2 = "<HTML>Click here to get an explanation of the
graph<BR>as it applies to the problem being solved.</HTML>";
protected String text3 = "<HTML>Selects the addition operation, which adds
the expression<BR>in the textbox to both sides of the equation
(inequality).</HTML>";
protected String text4 = "<HTML>Selects the subtraction operation, which
subtracts the expression<BR>in the textbox from both sides of the equation
(inequality).</HTML>";
protected String text5 = "<HTML>Selects the multiplication operation, which
multiplies both sides<BR>of the equation (inequality) by the expression in the
textbox.</HTML>";
protected String text6 = "<HTML>Selects the division operation, which divides
both sides<BR>of the equation (inequality) by the expression in the
textbox.</HTML>";
public void init()
{
this.button1 = new JButton("Button 1");
this.button1.setToolTipText(this.text1);
this.button2 = new JButton("Button 2");
this.button2.setToolTipText(this.text2);
this.button3 = new JButton("Button 3");
this.button3.setToolTipText(this.text3);
this.button4 = new JButton("Button 4");
this.button4.setToolTipText(this.text4);
this.button5 = new JButton("Button 5");
this.button5.requestFocus();
this.button5.setToolTipText(this.text5);
this.button6 = new JButton("Button 6");
this.button6.setToolTipText(this.text6);
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 0;
gbc.gridy = GridBagConstraints.RELATIVE;
gbc.insets = new Insets(0, 5, 5, 0);
gbc.weightx = 0.5;
gbl.setConstraints(this.button1, gbc);
gbl.setConstraints(this.button3, gbc);
gbl.setConstraints(this.button5, gbc);
gbc.gridx = 1;
gbl.setConstraints(this.button2, gbc);
gbl.setConstraints(this.button4, gbc);
gbl.setConstraints(this.button6, gbc);
JPanel panel = new JPanel(gbl, true);
panel.add(this.button1);
panel.add(this.button2);
panel.add(this.button3);
panel.add(this.button4);
panel.add(this.button5);
panel.add(this.button6);
panel.setBorder(new TitledBorder(" Buttons "));
this.getContentPane().add(panel);
} // ends init(void)
} // ends class RawToolTipDisplay
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFF00" TOPMARGIN="5" LEFTMARGIN="5" MARGINWIDTH="5"
MARGINHEIGHT="5">
<DIV ALIGN="CENTER">
<TABLE WIDTH="500" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="TOP">
This applet actually demonstrates several ToolTip bugs.
<UL>
<LI>Flickering of tips near bottom of applet
<LI>Tips showing raw HTML code (see below)
<LI>Tips showing text for previously viewed tip
</UL>
</TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="TOP">
<OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="300"
HEIGHT="175"
CODEBASE="http://java.sun.com/products/plugin/1.3/jinstall-13-
win32.cab#Version=1,3,0,0">
<PARAM NAME="CODE" VALUE="RawToolTipDisplay.class">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<COMMENT>
<EMBED TYPE="application/x-java-applet;version=1.3"
CODE="RawToolTipDisplay.class"
WIDTH="300" HEIGHT="175" scriptable=false
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<NOEMBED></NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
</TD>
</TR>
<TR>
<TD>
<BR>
To (incorrectly) show raw HTML code inside a ToolTip:
<UL>
<LI>Click on button 5 to place the purple border around it.
<LI>Then move (no clicking) over button 6 to display its tooltip.
<LI>Now, move (no clicking) over button 5 again. This should display raw
HTML in 5's tooltip.
If it doesn't, click a different button and move your mouse over multiple
buttons.
It will happen.
</UL>
</TD>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>
(Review ID: 118820)
======================================================================