0

私は JList 用の独自の ListCellRenderer を持っています。JList の要素は JPanel のものです。リストをクリックすると、それに集中する必要があります (例: list.getSelectedIndex())。しかし、JPanel と JPanel 内の要素にも注目する必要があります。

これが私のコードです:

ListCellRenderer<ClipboardObjectView> listCellRenderer = new ListCellRenderer<ClipboardObjectView>() {
        @Override
        public Component getListCellRendererComponent(
                JList<? extends ClipboardObjectView> list,
                ClipboardObjectView value, int index, boolean isSelected,
                boolean cellHasFocus) {
            return value;
        }
    };

ClipboardObjectView は私の JPanel です。ClipboardObjectView の mouseListener を実行しましたが、機能しません。

4

0 に答える 0