Destiny.Lin
1 year ago
5 changed files with 62 additions and 2 deletions
@ -0,0 +1,28 @@ |
|||||||
|
package com.fr.design.mainframe.vcs.ui; |
||||||
|
|
||||||
|
import com.fr.general.GeneralUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.table.DefaultTableCellRenderer; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 带ToolTip的UILabel的表格渲染类 |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class ToolTipTableCellRenderer extends DefaultTableCellRenderer { |
||||||
|
|
||||||
|
@Override |
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
||||||
|
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); |
||||||
|
if(component instanceof JLabel) { |
||||||
|
String toolTipText = GeneralUtils.objectToString(value); |
||||||
|
if (StringUtils.isNotEmpty(toolTipText)) { |
||||||
|
((JLabel) component).setToolTipText(toolTipText); |
||||||
|
} |
||||||
|
} |
||||||
|
return component; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue