Code
JList<String> list1 = new JList<String>(model) {
@Override public void updateUI() {
super.updateUI();
setCellRenderer(new TooltipListCellRenderer<>());
}
};
JScrollPane scroll1 = new JScrollPane(list1);
scroll1.addMouseWheelListener(e -> {
JScrollPane scrollPane = (JScrollPane) e.getComponent();
Component view = scrollPane.getViewport().getView();
MouseEvent event = SwingUtilities.convertMouseEvent(scrollPane, e, view);
ToolTipManager.sharedInstance().mouseMoved(event);
});
No comments:
Post a Comment