-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_98
Name: yyT116575 Date: 02/08/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)
JTable calls cellrender to get ToolTip text, but it does so for every mouse
move. Since tooltip should be shown only when the mouse pointer is idle over a
cell, mouse move event should not be sent to the renderer.
I believe this to be a bug or at the very least a design flaw.
This is particularly problematic when the renderer sets the color based on a
database query. Moving the mouse pointer over the cells floods the net with
database queries.
Look at the console when you move the mouse pointer over the cells...
test code
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class RendererTest extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent( JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
Component comp = super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
System.out.println( "rendering row: " + row + "; column: " + column);
return comp;
}
public static void main(String args[]) {
Object rows[][] = {{"A", "1"}, {"B", "2"}};
Object headers[] = {"Letters", "Numbers"};
JFrame frame = new JFrame("Renderer Test");
JTable table = new JTable(rows, headers);
TableCellRenderer renderer = new RendererTest();
table.setDefaultRenderer(Object.class, renderer);
JScrollPane scrollPane = new JScrollPane(table);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);
}
}
(Review ID: 116611)
======================================================================
- duplicates
-
JDK-4293264 ToolTipManager causes serious hit in perfomance (getToolTipText)
-
- Resolved
-