JList with tooltip text in DafaultListModel
问题 I have a JList and each item of the JList has a distinct display text and tooltip text. I would like to use 'DefaultListModel' for the JList. My question is that is it possible to somehow save the tooltip text when added an item to the DefaultListModel. Thanks. 回答1: You can override the getToolTipText(...) method to provide your custom tool tip. For example: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ListToolTip extends JFrame { public ListToolTip() {