-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
None
-
beta
-
sparc
-
solaris_7
We wanted the ability to reuse a tooltip, but it turns out this is problematic.
If you try the following code you'll notice on the second time the tool tip
shows the raw html instead of the formatted html.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
JScrollBar sb = new JScrollBar(JScrollBar.VERTICAL, 0, 30, 0, 100);
frame.getContentPane().setLayout(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout()) {
private JToolTip tip;
public JToolTip createToolTip() {
if (tip == null) {
tip = new JToolTip();
tip.setComponent(this);
}
return tip;
}
};
panel.setToolTipText("<html>HAR<b>BOLD</b>");
panel.setBorder(new EmptyBorder(10, 10, 10, 10));
panel.add(sb);
frame.add(panel);
frame.pack();
frame.show();
}
}
If you try the following code you'll notice on the second time the tool tip
shows the raw html instead of the formatted html.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
JScrollBar sb = new JScrollBar(JScrollBar.VERTICAL, 0, 30, 0, 100);
frame.getContentPane().setLayout(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout()) {
private JToolTip tip;
public JToolTip createToolTip() {
if (tip == null) {
tip = new JToolTip();
tip.setComponent(this);
}
return tip;
}
};
panel.setToolTipText("<html>HAR<b>BOLD</b>");
panel.setBorder(new EmptyBorder(10, 10, 10, 10));
panel.add(sb);
frame.add(panel);
frame.pack();
frame.show();
}
}