So I read a few threads that had tool tips working and tried to work off that to no avail.
import java.awt.event.MouseEvent;
public String getToolTipText(MouseEvent e) {
String tip = "tommy likes trucks";
java.awt.Point p = e.getPoint();
int rowIndex = FursJTable.rowAtPoint(p);
int colIndex = FursJTable.columnAtPoint(p);
int realColumnIndex = FursJTable.convertColumnIndexToModel(colIndex);
//if (description[realColumnIndex] = null || description[realColumnIndex] = "") {
// tip = null;
//} else {
// tip = description[realColumnIndex];
//}
return tip;
}
The if statement should just pull a string from an array I will have set up but even if I just set the tip at the beginning of the code it doesn't show a tooltip anywhere in my jtable. All help is appreciated. :)
I also need the tooltip to be across the entire row. but this still doesn't matter yet because i can't get the tooltip to appear anywhere.
The getToolTipText(...) method is part of the JTable. Since you are overriding the code in JTable there is no need for you to refer to an instance variable. Just use:
Also, follow Java naming conventions. Variable names should NOT start with an upper case character.
If you need more help then post a proper SSCCE that demonstrates the problem.
Edit:
One way to extend a component to override a single method is to do something like: