这里面包含了一百多个JAVA源文件

源代码在线查看: e938. setting tool tips on cells in a jtable component.txt

软件大小: 551 K
上传用户: maple_78
关键词: JAVA
下载地址: 免注册下载 普通下载 VIP

相关代码

				Unfortunately, there is no setToolTipText() method for cells in a JTable component. For a cell to show a tool tip, the renderer for that cell must set the tool tip text on the returned component. See e928 Creating a Custom Cell Renderer in a JTable Component for an example of a renderer that sets a tool tip. 
				If you cannot modify the renderer, you can override the table's prepareRenderer() method and explicitly set the tool tip on the returned component. 
				
				    // This table displays a tool tip text based on the string
				    // representation of the cell value
				    JTable table = new JTable() {
				        public Component prepareRenderer(TableCellRenderer renderer,
				                                         int rowIndex, int vColIndex) {
				            Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
				            if (c instanceof JComponent) {
				                JComponent jc = (JComponent)c;
				                jc.setToolTipText((String)getValueAt(rowIndex, vColIndex));
				            }
				            return c;
				        }
				    };
				
							

相关资源