当前位置: 技术问答>java相关
请教:如何将JTable里的内容显示在tool tip中?
来源: 互联网 发布时间:2015-08-12
本文导语: 比如说: CloumnA | CloumnB ————————— Value00 | Value01 Value10 | Value11 当我鼠标停在(0,0)上显示一个tool tip,tool tip的内容是Value00. | public class ToolTipCellRenderer extends D...
比如说:
CloumnA | CloumnB
—————————
Value00 | Value01
Value10 | Value11
当我鼠标停在(0,0)上显示一个tool tip,tool tip的内容是Value00.
CloumnA | CloumnB
—————————
Value00 | Value01
Value10 | Value11
当我鼠标停在(0,0)上显示一个tool tip,tool tip的内容是Value00.
|
public class ToolTipCellRenderer extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column){
super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
this.setToolTipText(value.toString());
}
}
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column){
super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
this.setToolTipText(value.toString());
}
}