package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public final class MainPanel extends JPanel {
    private MainPanel() {
        super(new BorderLayout());

        DefaultListModel<String> model = new DefaultListModel<>();
        for (String t: Arrays.asList("aa", "bbbbbbbbbbbbb", "ccc", "dddddddddddddddd", "eeeeeee")) {
            model.addElement(t);
        }
        JList<String> list = new LinkCellList<>(model);
        add(new JScrollPane(list));
        setPreferredSize(new Dimension(320, 240));
    }
    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                createAndShowGUI();
            }
        });
    }
    public static void createAndShowGUI() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException
               | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        }
        JFrame frame = new JFrame("@title@");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

class LinkCellList<E> extends JList<E> {
    private int prevIndex = -1;
    protected LinkCellList(ListModel<E> model) {
        super(model);
    }
    @Override public void updateUI() {
        setForeground(null);
        setBackground(null);
        setSelectionForeground(null);
        setSelectionBackground(null);
        super.updateUI();
        setFixedCellHeight(32);
        setCellRenderer(new LinkCellRenderer<E>());
        //TEST: putClientProperty("List.isFileList", Boolean.TRUE);
    }
    @Override protected void processMouseMotionEvent(MouseEvent e) {
        Point pt = e.getPoint();
        int i = locationToIndex(pt);
        E s = getModel().getElementAt(i);
        Component c = getCellRenderer().getListCellRendererComponent(this, s, i, false, false);
        Rectangle r = getCellBounds(i, i);
        c.setBounds(r);
        if (prevIndex != i) {
            c.doLayout();
        }
        prevIndex = i;
        pt.translate(-r.x, -r.y);
        Component cmp = SwingUtilities.getDeepestComponentAt(c, pt.x, pt.y);
        if (Objects.nonNull(cmp)) {
            setCursor(cmp.getCursor());
        } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
    }
}

class LinkCellRenderer<E> implements ListCellRenderer<E> {
    private final JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    private final JCheckBox check = new JCheckBox("check") {
        @Override public void updateUI() {
            super.updateUI();
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            setOpaque(false);
        }
    };
    private final JButton button = new JButton("button") {
        @Override public void updateUI() {
            super.updateUI();
            setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
        }
    };
    private final JLabel label = new JLabel() {
        @Override public void updateUI() {
            super.updateUI();
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }
    };
    @Override public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
        p.removeAll();
        p.add(label);
        p.add(check);
        p.add(button);
        p.setOpaque(true);
        if (isSelected) {
            p.setBackground(list.getSelectionBackground());
            p.setForeground(list.getSelectionForeground());
        } else {
            p.setBackground(list.getBackground());
            p.setForeground(list.getForeground());
        }
        label.setText("<html><a href='#'>" + value);
        return p;
    }
}

@@ -2439,24 +2439,38 @@
     
-Component cmp = 
+setCursor(Optional.ofNullable(
 Swin
@@ -2516,17 +2516,17 @@
 x, pt.y)
-;
+)
 %0A       
@@ -2530,62 +2530,42 @@
     
-if (Objects.nonNull(cmp)) %7B%0A            setCursor(cmp.
+                  .map(Component::
 getC
@@ -2569,20 +2569,17 @@
 etCursor
-());
+)
 %0A       
@@ -2575,33 +2575,25 @@
 or)%0A        
-%7D else %7B%0A
+ 
             
@@ -2588,33 +2588,36 @@
             
-setCursor
+     .orElse
 (Cursor.getP
@@ -2651,35 +2651,26 @@
 ULT_CURSOR))
+)
 ;
-%0A        %7D
 %0A    %7D%0A%7D%0A%0Acl

use Optional#ifPresent(...) instead of if (Objects.nonNull(o)) {...}