I have a table where each row represents a picture. In the column Path I store its absolute path. The string being kinda long, I would like that when I hover the mouse over the specific cell, a tooltip should pop-up next to the mouse containing the information from the cell.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You say you store an absolute path in a cell. You are probably using a
JLabel
for setting absolute path string. Suppose you have a label in your cell, use html tags for expressing tooltip content:setToolTipText()
can be used for some other Swing components if you are using something other than JLabel.I assume you didn't write a custom
CellRenderer
for the path but just use theDefaultTableCellRenderer
. You should subclass theDefaultTableCellRenderer
and set the tooltip in thegetTableCellRendererComponent
. Then set the renderer for the column.Just use below code while creation of JTable object.